Avara3D 0.2.0
C++ API reference
Dome.h
1//
2// Dome.h
3// avara3d
4//
5// Created by Morgan Davis on 3/21/26.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_MESH_PRIMITIVE_DOME_H
10#define AVARA3D_MESH_PRIMITIVE_DOME_H
11
12#include <memory>
13
14#include "a3d/mesh/MeshElement.h"
15
16namespace a3d {
17
18 class Mesh;
19 class Material;
20
29 class Dome : public MeshElement {
30
31 public:
32 // [Public Static Member Functions]
33
34 // NOTE: this is NOT centered.
36 static std::shared_ptr<Mesh> Mesh(float radius,
37 float azimuthStart,
38 float azimuthSweep,
39 float elevationStart,
40 float elevationSweep,
41 unsigned slices = DEFAULT_SLICES,
42 unsigned segments = DEFAULT_SEGMENTS,
43 std::shared_ptr<Material> material = nullptr);
44
45 // [Public Lifecycle Functions]
46
47 // z, x, y?
49 Dome(float radius,
50 float azimuthStart,
51 float azimuthSweep,
52 float elevationStart,
53 float elevationSweep,
54 unsigned slices = DEFAULT_SLICES,
55 unsigned segments = DEFAULT_SEGMENTS);
56
57 // [Public Member Functions]
58
60 float radius() const;
61
63 float azimuthStart() const;
64
66 float azimuthSweep() const;
67
69 float elevationStart() const;
70
72 float elevationSweep() const;
73
75 unsigned slices() const;
76
78 unsigned segments() const;
79
80 private:
81 // [Private Constants]
82
83 static constexpr int DEFAULT_SLICES = 32; // around circumference (azimuth / longitude)
84 static constexpr int DEFAULT_SEGMENTS = 8; // bottom-to-top (elevation / latitude)
85
86 // [Private Member Variables]
87
88 float _radius;
89 float _azimuthStart;
90 float _azimuthSweep;
91 float _elevationStart;
92 float _elevationSweep;
93 unsigned _slices;
94 unsigned _segments;
95 };
96
97}
98
99#endif // AVARA3D_MESH_PRIMITIVE_DOME_H
Generates a bounded angular patch of a sphere centered at the origin.
Definition: Dome.h:29
Dome(float radius, float azimuthStart, float azimuthSweep, float elevationStart, float elevationSweep, unsigned slices=DEFAULT_SLICES, unsigned segments=DEFAULT_SEGMENTS)
Generates a spherical patch with the supplied angular ranges and subdivisions.
float radius() const
Returns the source sphere radius.
unsigned segments() const
Returns the elevation subdivision count.
float azimuthStart() const
Returns the azimuth start angle in radians.
unsigned slices() const
Returns the azimuth subdivision count.
float elevationSweep() const
Returns the elevation sweep angle in radians.
float elevationStart() const
Returns the elevation start angle in radians.
float azimuthSweep() const
Returns the azimuth sweep angle in radians.
static std::shared_ptr< Mesh > Mesh(float radius, float azimuthStart, float azimuthSweep, float elevationStart, float elevationSweep, unsigned slices=DEFAULT_SLICES, unsigned segments=DEFAULT_SEGMENTS, std::shared_ptr< Material > material=nullptr)
Creates a Mesh containing a Dome and optional material.
Owns the vertex and optional index data for one mesh primitive.
Definition: MeshElement.h:43