Avara3D 0.2.0
C++ API reference
Plane.h
1//
2// Plane.h
3// avara3d
4//
5// Created by Morgan Davis on 10/31/17.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_MESH_PRIMITIVE_PLANE_H
10#define AVARA3D_MESH_PRIMITIVE_PLANE_H
11
12#include <memory>
13
14#include "a3d/mesh/MeshElement.h"
15
16namespace a3d {
17
18 class Mesh;
19 class Material;
20
26 class Plane : public MeshElement {
27
28 public:
29 // [Public Static Member Functions]
30
32 static std::shared_ptr<Mesh> Mesh(float width, // x
33 float height, // y
34 unsigned widthSegements = DEFAULT_SEGMENTS,
35 unsigned heightSegments = DEFAULT_SEGMENTS,
36 std::shared_ptr<Material> material = nullptr);
37
38 // [Public Lifecycle Functions]
39
41 Plane(float width,
42 float height,
43 unsigned widthSegements = DEFAULT_SEGMENTS,
44 unsigned heightSegments = DEFAULT_SEGMENTS);
45
46 // [Public Member Functions]
47
49 float width() const;
50
52 float height() const;
53
55 unsigned widthSegements() const;
56
58 unsigned heightSegments() const;
59
60 private:
61 // [Private Constants]
62
63 static constexpr unsigned DEFAULT_SEGMENTS = 8;
64
65 // [Private Member Variables]
66
67 float _width;
68 float _height;
69 unsigned _widthSegements;
70 unsigned _heightSegments;
71 };
72
73}
74
75#endif // AVARA3D_MESH_PRIMITIVE_PLANE_H
Owns the vertex and optional index data for one mesh primitive.
Definition: MeshElement.h:43
Rectangular grid mesh element centered at the origin in the XY plane.
Definition: Plane.h:26
unsigned heightSegments() const
Returns the height subdivision count.
float height() const
Returns the configured plane height along Y.
static std::shared_ptr< Mesh > Mesh(float width, float height, unsigned widthSegements=DEFAULT_SEGMENTS, unsigned heightSegments=DEFAULT_SEGMENTS, std::shared_ptr< Material > material=nullptr)
Creates a Mesh containing a Plane and optional material.
float width() const
Returns the configured plane width along X.
unsigned widthSegements() const
Returns the width subdivision count.
Plane(float width, float height, unsigned widthSegements=DEFAULT_SEGMENTS, unsigned heightSegments=DEFAULT_SEGMENTS)
Generates plane geometry with the supplied dimensions and subdivision counts.