API Documentation
Loading...
Searching...
No Matches
ShapeConstructors.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Design
28File: ShapeConstructors
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/BaseValues.h>
35#include <NDEVR/Matrix.h>
36#include <NDEVR/Vertex.h>
37#include <NDEVR/Bounds.h>
38namespace NDEVR
39{
40 class Geometry;
41 class Scene;
42
43 /**--------------------------------------------------------------------------------------------------
44 \brief Logic for setting up a mesh that is broken apart by latitude and longitude lines with a set
45 angle difference between them.
46 **/
48 {
50 : size(width, height)
51 {}
52 Vector<2, uint04> size = Vector <2, uint04>(44, 32);
57 private:
58 Vector<2, Angle<fltp08>> _vertexIndexToAngle(uint04 index) const;
59 uint04 _angleToVertexIndex(Vector<2, Angle<fltp08>> angle) const;
60
61 };
62
63 /**--------------------------------------------------------------------------------------------------
64 \brief Logic for writing various basic shapes to a Geometry object. Shapes will be appended to the end
65 of the geometry.
66 **/
68 {
69 public:
70 static Geometry StaticLine(Scene& parent);
75 static void Rectangle(Geometry& mesh, const Matrix<fltp08>& trans = Matrix<fltp08>(1), fltp08 top_length = 2.0, fltp08 bottom_length = 2.0, fltp08 left_length = 2.0, fltp08 right_length = 2.0, fltp08 vertical_scew = 0.0, fltp08 horizontal_scew = 0.0);
76 static void RectangularPrism(Geometry& mesh, const Matrix<fltp08>& trans = Matrix<fltp08>(1));
77 static void Circle(Geometry& mesh, const Matrix<fltp08>& trans = Matrix<fltp08>(1), uint04 width_segments = 128, fltp08 radius = 1.0f, Angle<fltp08> phi_start = Angle<fltp08>(DEGREES, 0.0f), Angle<fltp08> phi_length = Angle<fltp08>(DEGREES, 360.0f), bool join = true);
78 static void Cylinder(Geometry& mesh, const Matrix<fltp08>& trans = Matrix<fltp08>(1), uint04 width_segments = 44, fltp08 top_radius = 1.0f, fltp08 bottom_radius = 1.0, fltp08 height = 1.0, Angle<fltp08> phi_start = Angle<fltp08>(DEGREES, 0.0f), Angle<fltp08> phi_length = Angle<fltp08>(DEGREES, 360.0f), bool draw_top_circle = true, bool draw_bottom_circle = true);
79 static void Cone(Geometry& mesh, const Matrix<fltp08>& trans = Matrix<fltp08>(1), uint04 width_segments = 44, fltp08 bottom_radius = 1.0, fltp08 height = 1.0, Angle<fltp08> phi_start = Angle<fltp08>(DEGREES, 0.0f), Angle<fltp08> phi_length = Angle<fltp08>(DEGREES, 360.0f), bool draw_bottom_circle = true);
80 static void Sphere(Geometry& mesh, uint04 width_segments = 44, uint04 height_segments = 32, Angle<fltp08> phi_start = Angle<fltp08>(DEGREES, 0.0f), Angle<fltp08> phi_length = Angle<fltp08>(DEGREES, 360.0f), Angle<fltp08> theta_start = Angle<fltp08>(DEGREES, 0.0f), Angle<fltp08> theta_length = Angle<fltp08>(DEGREES, 180.0f));
81 static void ZippedRadialMesh(Geometry& mesh, const ZippedRadialMeshOptions& options);
82 static void ZippedTorus(Geometry& mesh, uint04 width_segments = 44, uint04 height_segments = 32);
83 protected:
84 static void SetupStaticGeometry(Geometry& geo);
85 };
86}
87
88
89
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
The primary angle storage class for this API. Stores an angle in an optimized format.
Definition StringStream.h:540
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:52
A core class within the model heirarchy containing vertex-based data (Usually 3D data) within a set c...
Definition Geometry.h:64
Definition Matrix.hpp:176
The root Model that is responsible for storing the underlying data for all Scene Models.
Definition Model.h:492
Logic for writing various basic shapes to a Geometry object. Shapes will be appended to the end of th...
Definition ShapeConstructors.h:68
static void Rectangle(Geometry &mesh, const Matrix< fltp08 > &trans=Matrix< fltp08 >(1), fltp08 top_length=2.0, fltp08 bottom_length=2.0, fltp08 left_length=2.0, fltp08 right_length=2.0, fltp08 vertical_scew=0.0, fltp08 horizontal_scew=0.0)
static void Sphere(Geometry &mesh, uint04 width_segments=44, uint04 height_segments=32, Angle< fltp08 > phi_start=Angle< fltp08 >(DEGREES, 0.0f), Angle< fltp08 > phi_length=Angle< fltp08 >(DEGREES, 360.0f), Angle< fltp08 > theta_start=Angle< fltp08 >(DEGREES, 0.0f), Angle< fltp08 > theta_length=Angle< fltp08 >(DEGREES, 180.0f))
static Geometry StaticLine(Scene &parent)
static void Cone(Geometry &mesh, const Matrix< fltp08 > &trans=Matrix< fltp08 >(1), uint04 width_segments=44, fltp08 bottom_radius=1.0, fltp08 height=1.0, Angle< fltp08 > phi_start=Angle< fltp08 >(DEGREES, 0.0f), Angle< fltp08 > phi_length=Angle< fltp08 >(DEGREES, 360.0f), bool draw_bottom_circle=true)
static Geometry StaticCircleOutline(Scene &parent)
static void Circle(Geometry &mesh, const Matrix< fltp08 > &trans=Matrix< fltp08 >(1), uint04 width_segments=128, fltp08 radius=1.0f, Angle< fltp08 > phi_start=Angle< fltp08 >(DEGREES, 0.0f), Angle< fltp08 > phi_length=Angle< fltp08 >(DEGREES, 360.0f), bool join=true)
static void Quad(Geometry &mesh, const Matrix< fltp08 > &trans, Vertex< 3, fltp08 > p1, Vertex< 3, fltp08 > p2, Vertex< 3, fltp08 > p3, Vertex< 3, fltp08 > p4)
static void Cylinder(Geometry &mesh, const Matrix< fltp08 > &trans=Matrix< fltp08 >(1), uint04 width_segments=44, fltp08 top_radius=1.0f, fltp08 bottom_radius=1.0, fltp08 height=1.0, Angle< fltp08 > phi_start=Angle< fltp08 >(DEGREES, 0.0f), Angle< fltp08 > phi_length=Angle< fltp08 >(DEGREES, 360.0f), bool draw_top_circle=true, bool draw_bottom_circle=true)
static void ZippedRadialMesh(Geometry &mesh, const ZippedRadialMeshOptions &options)
static Geometry StaticRectangleFilled(Scene &parent)
static void SetupStaticGeometry(Geometry &geo)
static void ZippedTorus(Geometry &mesh, uint04 width_segments=44, uint04 height_segments=32)
static Geometry StaticRectangularPrismFilled(Scene &parent)
static void RectangularPrism(Geometry &mesh, const Matrix< fltp08 > &trans=Matrix< fltp08 >(1))
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
Logic for setting up a mesh that is broken apart by latitude and longitude lines with a set angle dif...
Definition ShapeConstructors.h:48
Vector< 2, uint04 > size
Definition ShapeConstructors.h:52
Bounds< 2, Angle< fltp08 > > radial_bounds
Definition ShapeConstructors.h:53
Vector< 2, fltp08 > angleToTextureCoord(Vector< 2, Angle< fltp08 > > angle) const
ZippedRadialMeshOptions(uint04 width, uint04 height)
Definition ShapeConstructors.h:49
uint04 angleToVertexIndex(Vector< 2, Angle< fltp08 > > angle) const
Vector< 2, Angle< fltp08 > > vertexIndexToAngle(uint04 index) const