Avara3D 0.2.0
C++ API reference
Wedge.h
1//
2// Wedge.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_WEDGE_H
10#define AVARA3D_MESH_PRIMITIVE_WEDGE_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 Wedge : public MeshElement {
30
31 public:
32 // [Public Static Member Functions]
33
34 // slanted side faces +Y.
35 // pointy end faces -X, thick end faces +X.
37 static std::shared_ptr<Mesh> Mesh(float length,
38 float width,
39 float height,
40 unsigned runSegments = DEFAULT_RUN_SEGMENTS,
41 unsigned widthSegments = DEFAULT_WIDTH_SEGMENTS,
42 unsigned riseSegments = DEFAULT_RISE_SEGMENTS,
43 std::shared_ptr<Material> material = nullptr);
44
45 // [Public Lifecycle Functions]
46
49 float width,
50 float height,
51 unsigned runSegments = DEFAULT_RUN_SEGMENTS,
52 unsigned widthSegments = DEFAULT_WIDTH_SEGMENTS,
53 unsigned riseSegments = DEFAULT_RISE_SEGMENTS);
54
55 // [Public Member Functions]
56
58 float length() const;
59
61 float width() const;
62
64 float height() const;
65
67 unsigned runSegments() const;
68
70 unsigned widthSegments() const;
71
73 unsigned riseSegments() const;
74
75 private:
76 // [Private Constants]
77
78 // this is kind of jacked up.
79 static constexpr int DEFAULT_RUN_SEGMENTS = 1; // thin end (-X) toward the thick/tall end (+X)
80 static constexpr int DEFAULT_WIDTH_SEGMENTS = 1; // across the wedge from one side to the other along Z
81 static constexpr int DEFAULT_RISE_SEGMENTS = 1; // upward along the tall vertical face in +Y
82
83 // [Private Member Variables]
84
85 float _length;
86 float _width;
87 float _height;
88 unsigned _runSegments;
89 unsigned _widthSegments;
90 unsigned _riseSegments;
91 };
92
93}
94
95#endif // AVARA3D_MESH_PRIMITIVE_WEDGE_H
Owns the vertex and optional index data for one mesh primitive.
Definition: MeshElement.h:43
Wedge mesh element extending along X, Y, and Z.
Definition: Wedge.h:29
Wedge(float length, float width, float height, unsigned runSegments=DEFAULT_RUN_SEGMENTS, unsigned widthSegments=DEFAULT_WIDTH_SEGMENTS, unsigned riseSegments=DEFAULT_RISE_SEGMENTS)
Generates wedge geometry with the supplied dimensions and subdivision counts.
float width() const
Returns the configured wedge width along Z.
float height() const
Returns the configured wedge height along Y.
float length() const
Returns the configured wedge length along X.
unsigned widthSegments() const
Returns the subdivision count across the wedge width in Z.
unsigned runSegments() const
Returns the subdivision count along the wedge run in X.
unsigned riseSegments() const
Returns the subdivision count along the vertical rise in Y.
static std::shared_ptr< Mesh > Mesh(float length, float width, float height, unsigned runSegments=DEFAULT_RUN_SEGMENTS, unsigned widthSegments=DEFAULT_WIDTH_SEGMENTS, unsigned riseSegments=DEFAULT_RISE_SEGMENTS, std::shared_ptr< Material > material=nullptr)
Creates a Mesh containing a Wedge and optional material.