Class representing a triangle mesh object with the ability to manipulate the object in 3D space before discretizing/rasterizing the object to display on some LED cube matrix. A constraint can be set to the max number of verticies expected by this mesh object.
More...
#include <TriangleMesh.hpp>
|
| template<size_t LEDNum> |
| void | SetColor (std::array< float, LEDNum > &blueMatrix, std::array< float, LEDNum > &greenMatrix, std::array< float, LEDNum > &redMatrix, Eigen::Vector4f color) |
| | sets all of the colors in the LED array to a specific value More...
|
| |
| void | SetFillColor (Eigen::Vector4f color) |
| | Sets the fill color of the mesh when displaying nothing. More...
|
| |
| void | SetProjectionSpace (int i) |
| | Set the projection space for the rasterization of a cube by specifying one length. More...
|
| |
| void | SetProjectionSpace (int x, int y, int z) |
| | Set the projection space for the rasterization by specifying the three different dimensions. More...
|
| |
| void | SetDrawOptions (DrawOptions d) |
| | Set drawing options bits in the struct. Multiple drawing options can be set together, and will be performed sequentially. For instance, drawing all verticies, then triangle edges. However, setting these drawing bits with the other test modes will result in them being ignored. Multiple testing bits set will result in undefined behavior. More...
|
| |
|
void | ClearDrawOption () |
| | Clears the drawing options. Should always be called when attempting to modify the options of unknown value.
|
| |
| template<size_t vertLength> |
| bool | AllocateVerts (const std::array< float, vertLength > &verts_sequential) |
| | Allocates all of the verticies into a Eigen Matrix for simple and fast manipulation. More...
|
| |
| template<size_t colorLength> |
| bool | AllocateColors (const std::array< float, colorLength > &colors_sequential) |
| | Allocates all of the colors into a Eigen Matrix. More...
|
| |
| template<size_t trianglesLength> |
| bool | AllocateTriangles (const std::array< int, trianglesLength > &triangles_sequential) |
| | Allocates all of the triangle into a Eigen Matrix. More...
|
| |
| void | Transform (Eigen::Matrix< float, 4, 4 > &transform) |
| | Applies the given transformation to the triangle mesh and stores this in verts_transformed. More...
|
| |
| template<size_t LEDNum> |
| void | Rasterize (std::array< float, LEDNum > &blueMatrix, std::array< float, LEDNum > &greenMatrix, std::array< float, LEDNum > &redMatrix) |
| | Draws triangles on the LED matrix. The dimension of the LED matrix is templated, and the total number of LEDs in the matrix is given by multiplying all template parameters together. The output colors channels should match this dimension. More...
|
| |
|
| bool | InBounds (Eigen::Vector4i &v) |
| | tests a point to determine if it is in bounds within the projection space. Inclusive of 0, Exclusive of the projection space dimension More...
|
| |
|
|
Eigen::Matrix< float, 4, Eigen::Dynamic, 0, 4, maxVertNum > | verts |
| | Position of each verticies loaded after call to AllocateVerts(), stored as x,y,z.
|
| |
|
Eigen::Matrix< float, 4, Eigen::Dynamic, 0, 4, maxVertNum > | verts_tranformed |
| | Current position of the verticies.
|
| |
|
Eigen::Matrix< int, 3, Eigen::Dynamic, 0, 3, maxVertNum > | triangles |
| | Index position of triangles.
|
| |
|
Eigen::Matrix< float, 4, Eigen::Dynamic, 0, 4, maxVertNum > | colors |
| | Color of each vertex, each column matches the vertex location in the same column of verts.
|
| |
|
int | numOfTriangles = 0 |
| |
|
Eigen::Vector3i | projectionSpace = Eigen::Vector3i() |
| |
|
Eigen::Vector4f | fillColor = Eigen::Vector4f(0.0f,0.0f,0.0f,1.0f) |
| | Base color to reset LEDs to. Default is zero.
|
| |
|
Status | meshState = Status::None |
| | Tracks the current state of the mesh. Alter state through calls to allocate functions and setProjectionSpace()
|
| |
|
DrawOptions | drawOptions = DrawOptions::None |
| | Drawing options for rasterization and different drawing functions. The draw vertex, edge, and fill modes can be set together and will be performed together. However, setting any of these with the test options will cause them to be overridden. Calling multiple tests together will result in undefined behavior.
|
| |
|
int | sequenceDrawn = 0 |
| | sequence number previously drawn to aid in drawing the sequential test function
|
| |
template<size_t maxVertNum = 512>
class TriangleMesh< maxVertNum >
Class representing a triangle mesh object with the ability to manipulate the object in 3D space before discretizing/rasterizing the object to display on some LED cube matrix. A constraint can be set to the max number of verticies expected by this mesh object.
The TriangleMesh can be dispayed with a call to Rasterize given proper initialization has been performed and DrawOptions has been set. The Drawing options can be changed dynamically by calling SetDrawOptions.
◆ AllocateColors()
template<size_t maxVertNum = 512>
template<size_t colorLength>
| bool TriangleMesh< maxVertNum >::AllocateColors |
( |
const std::array< float, colorLength > & |
colors_sequential | ) |
|
|
inline |
Allocates all of the colors into a Eigen Matrix.
- Parameters
-
| colorLength | Number of elements int colors_sequential |
| colors_sequential | vector of colors sequentially stored with three floats |
- Returns
- bool indicating if allocation was successful
◆ AllocateTriangles()
template<size_t maxVertNum = 512>
template<size_t trianglesLength>
| bool TriangleMesh< maxVertNum >::AllocateTriangles |
( |
const std::array< int, trianglesLength > & |
triangles_sequential | ) |
|
|
inline |
Allocates all of the triangle into a Eigen Matrix.
- Parameters
-
| trianglesLength | 3 * num of triangles - length of triangles_sequential |
| triangles_sequential | vector of colors sequentially stored with three floats |
- Returns
- bool indicating if allocation was successful
◆ AllocateVerts()
template<size_t maxVertNum = 512>
template<size_t vertLength>
| bool TriangleMesh< maxVertNum >::AllocateVerts |
( |
const std::array< float, vertLength > & |
verts_sequential | ) |
|
|
inline |
Allocates all of the verticies into a Eigen Matrix for simple and fast manipulation.
- Parameters
-
| vertLength | Number of elements in verts_sequential |
| verts_sequential | vector of verticies positions sequentially stored with three floats |
- Returns
- bool indicating if allocation was successful
◆ InBounds()
template<size_t maxVertNum = 512>
| bool TriangleMesh< maxVertNum >::InBounds |
( |
Eigen::Vector4i & |
v | ) |
|
|
inlineprivate |
tests a point to determine if it is in bounds within the projection space. Inclusive of 0, Exclusive of the projection space dimension
- Parameters
-
| v | (x,y,z,1) vector to test |
- Returns
- boolean value corresponding to if v is in bounds
◆ Rasterize()
template<size_t maxVertNum = 512>
template<size_t LEDNum>
| void TriangleMesh< maxVertNum >::Rasterize |
( |
std::array< float, LEDNum > & |
blueMatrix, |
|
|
std::array< float, LEDNum > & |
greenMatrix, |
|
|
std::array< float, LEDNum > & |
redMatrix |
|
) |
| |
|
inline |
Draws triangles on the LED matrix. The dimension of the LED matrix is templated, and the total number of LEDs in the matrix is given by multiplying all template parameters together. The output colors channels should match this dimension.
For Triangle fill, bilinear interpolation is used to determine the color For Edge drawing a simple line interpolation method is used to determine the color For Vertex drawing, there is no interpolation
For the cellular automata mode the triangles and colors do not need to be set, only the vertex array with AllocateVerticies(). However, changing the drawing options without allocating these array will result in an error. Each call to rasterize will advance the time by 1 and update the LED matrix accordingly.
There are two tests modes DrawTestFill and DrawTestSequential which can be set in the Drawing options. DrawTestFill -> fills the entire array and results in a breathing appearance for the arrays. The timestep is advanced with each call to Rasterize DrawTestSequential -> Sets one LED and increments the LED. Advances the LED on each call to Rasterize
Setting any triangle/vertex drawing and tests will result only the test being called. Multiple tests bits set will result in undefined behavior
- Parameters
-
| LEDNum | number of LEDs in the matrix |
| blueMatrix | XxYxZ float matrix to represent the blue component of the LED matrix. |
| greenMatrix | XxYxZ float matrix to represent the green component of the LED matrix. |
| redMatrix | XxYxZ float matrix to represent the red component of the LED matrix. |
- Returns
- true if sucessfully wrote to color arrays
◆ SetColor()
template<size_t maxVertNum = 512>
template<size_t LEDNum>
| void TriangleMesh< maxVertNum >::SetColor |
( |
std::array< float, LEDNum > & |
blueMatrix, |
|
|
std::array< float, LEDNum > & |
greenMatrix, |
|
|
std::array< float, LEDNum > & |
redMatrix, |
|
|
Eigen::Vector4f |
color |
|
) |
| |
|
inline |
sets all of the colors in the LED array to a specific value
- Parameters
-
| LEDNum | Number of LEDs in the array |
| blueMatrix | XxYxZ float matrix to represent the blue component of the LED matrix. |
| greenMatrix | XxYxZ float matrix to represent the green component of the LED matrix. |
| redMatrix | XxYxZ float matrix to represent the red component of the LED matrix. |
| color | Eigen Vector representing the color to set all LEDs to |
◆ SetDrawOptions()
template<size_t maxVertNum = 512>
| void TriangleMesh< maxVertNum >::SetDrawOptions |
( |
DrawOptions |
d | ) |
|
|
inline |
Set drawing options bits in the struct. Multiple drawing options can be set together, and will be performed sequentially. For instance, drawing all verticies, then triangle edges. However, setting these drawing bits with the other test modes will result in them being ignored. Multiple testing bits set will result in undefined behavior.
- Parameters
-
| d | pattern to add to the struct |
◆ SetFillColor()
template<size_t maxVertNum = 512>
| void TriangleMesh< maxVertNum >::SetFillColor |
( |
Eigen::Vector4f |
color | ) |
|
|
inline |
Sets the fill color of the mesh when displaying nothing.
- Parameters
-
◆ SetProjectionSpace() [1/2]
template<size_t maxVertNum = 512>
| void TriangleMesh< maxVertNum >::SetProjectionSpace |
( |
int |
i | ) |
|
|
inline |
Set the projection space for the rasterization of a cube by specifying one length.
- Parameters
-
| i | single value to set cube projection space of length i |
◆ SetProjectionSpace() [2/2]
template<size_t maxVertNum = 512>
| void TriangleMesh< maxVertNum >::SetProjectionSpace |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
z |
|
) |
| |
|
inline |
Set the projection space for the rasterization by specifying the three different dimensions.
- Parameters
-
◆ Transform()
template<size_t maxVertNum = 512>
| void TriangleMesh< maxVertNum >::Transform |
( |
Eigen::Matrix< float, 4, 4 > & |
transform | ) |
|
|
inline |
Applies the given transformation to the triangle mesh and stores this in verts_transformed.
- Parameters
-
| transform | 4x4 transformation matrix to be applies |
The documentation for this class was generated from the following file:
- /home/joseph/Desktop/School/ECE 47700/lumi-voxel-triangle-mesh/lumi-voxel-triangle-mesh/include/TriangleMesh.hpp