Avara3D 0.2.0
C++ API reference
Cone.h
1//
2// Cone.h
3// avara3d
4//
5// Created by Morgan Davis on 11/8/17.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_MESH_PRIMITIVE_CONE_H
10#define AVARA3D_MESH_PRIMITIVE_CONE_H
11
12#include <memory>
13
14#include "a3d/mesh/MeshElement.h"
15
16namespace a3d {
17
18 class Mesh;
19 class Material;
20
28 class Cone : public MeshElement {
29
30 public:
31 // [Public Static Member Functions]
32
34 static std::shared_ptr<Mesh> Mesh(float radius,
35 float height,
36 unsigned slices = DEFAULT_SLICES,
37 unsigned segments = DEFAULT_SEGMENTS,
38 unsigned rings = DEFAULT_RINGS,
39 std::shared_ptr<Material> material = nullptr);
40
41 // [Public Lifecycle Functions]
42
44 Cone(float radius,
45 float height,
46 unsigned slices = DEFAULT_SLICES,
47 unsigned segments = DEFAULT_SEGMENTS,
48 unsigned rings = DEFAULT_RINGS);
49
50 // [Public Member Functions]
51
53 float radius() const;
54
56 float height() const;
57
59 unsigned slices() const;
60
62 unsigned segments() const;
63
65 unsigned rings() const;
66
67 private:
68 // [Private Constants]
69
70 static constexpr unsigned DEFAULT_SLICES = 32;
71 static constexpr unsigned DEFAULT_SEGMENTS = 8;
72 static constexpr unsigned DEFAULT_RINGS = 4;
73
74 // [Private Member Variables]
75
76 float _radius;
77 float _height;
78 unsigned _slices;
79 unsigned _segments;
80 unsigned _rings;
81 };
82
83}
84
85#endif // AVARA3D_MESH_PRIMITIVE_CONE_H
Capped cone mesh element centered at the origin and aligned along the Y axis.
Definition: Cone.h:28
static std::shared_ptr< Mesh > Mesh(float radius, float height, unsigned slices=DEFAULT_SLICES, unsigned segments=DEFAULT_SEGMENTS, unsigned rings=DEFAULT_RINGS, std::shared_ptr< Material > material=nullptr)
Creates a Mesh containing a Cone and optional material.
unsigned rings() const
Returns the radial cap subdivision count.
unsigned segments() const
Returns the axial subdivision count.
float radius() const
Returns the configured base radius.
unsigned slices() const
Returns the circumferential subdivision count.
float height() const
Returns the configured axial height.
Cone(float radius, float height, unsigned slices=DEFAULT_SLICES, unsigned segments=DEFAULT_SEGMENTS, unsigned rings=DEFAULT_RINGS)
Generates capped cone geometry with the supplied dimensions and subdivisions.
Owns the vertex and optional index data for one mesh primitive.
Definition: MeshElement.h:43