FadeExport is a simple struct to export triangulation data.
More...
#include <FadeExport.h>
|
| FadeExport () |
| Default constructor.
|
|
| FadeExport (const FadeExport &other) |
| Copy constructor.
|
|
| ~FadeExport () |
| Destructor.
|
|
void | copy (const FadeExport &other) |
| A copy function. More...
|
|
void | extractTriangleNeighborships (std::vector< std::pair< int, int > > &vNeigs) const |
| Extracts triangle adjacencies. More...
|
|
void | getCoordinates (int vtxIdx, double &x, double &y, double &z) const |
| Get the coorinates for a certain vertex index. More...
|
|
void | getCornerIndices (int triIdx, int &vtxIdx0, int &vtxIdx1, int &vtxIdx2) const |
| Get the corner indices of a certain triangle. More...
|
|
int | getCustomIndex (int vtxIdx) const |
| Get the custom vertex index. More...
|
|
void | getNormal (int triIdx, double &x, double &y, double &z) const |
| Gets the normal vector of a triangle. More...
|
|
void | lexiSort () |
| Lexicographically sorts the points. More...
|
|
FadeExport & | operator= (const FadeExport &other) |
| Assignment operator.
|
|
bool | operator== (const FadeExport &other) const |
|
void | print () const |
| Prints the data for demonstration purposes. More...
|
|
void | reset () |
| Resets the object. More...
|
|
bool | writeObj (const char *filename) const |
| Writes the triangulation data to a .obj file. More...
|
|
|
double * | aCoords |
| Cartesian coordinates (dim*numPoints)
|
|
int * | aCustomIndices |
| Custom indices of the points (only when exported)
|
|
int * | aTriangles |
| 3 counterclockwise oriented vertex-indices per triangle (3*numTriangles)
|
|
int | dim |
| Dimension.
|
|
int | numCustomIndices |
| number of custom indices (same as numPoints when exported, otherwise 0)
|
|
int | numPoints |
| number of points
|
|
int | numTriangles |
| number of triangles
|
|
This data structure is designed to get data out of Fade easily and memory efficiently using only basic data types.
- Note
- The important source code for this struct is implemented in the
FadeExport.h
file, allowing users to adapt the code for their own needs.
- See also
- https://www.geom.at/triangulation-export/ This article describes exporting triangulations.
◆ copy()
void GEOM_FADE25D::FadeExport::copy |
( |
const FadeExport & |
other | ) |
|
|
inline |
Copies the other
FadeExport struct to the current one.
- Parameters
-
◆ extractTriangleNeighborships()
void GEOM_FADE25D::FadeExport::extractTriangleNeighborships |
( |
std::vector< std::pair< int, int > > & |
vNeigs | ) |
const |
|
inline |
This method extracts the adjacency relationships between triangles by identifying which triangles share an edge. It populates the provided vector with pairs of adjacent triangle indices.
- Parameters
-
vNeigs | A vector that will be populated with pairs of adjacent triangle indices. |
◆ getCoordinates()
void GEOM_FADE25D::FadeExport::getCoordinates |
( |
int |
vtxIdx, |
|
|
double & |
x, |
|
|
double & |
y, |
|
|
double & |
z |
|
) |
| const |
|
inline |
- Parameters
-
vtxIdx | [in] vertex index |
x,y,z | [out] coordinates |
◆ getCornerIndices()
void GEOM_FADE25D::FadeExport::getCornerIndices |
( |
int |
triIdx, |
|
|
int & |
vtxIdx0, |
|
|
int & |
vtxIdx1, |
|
|
int & |
vtxIdx2 |
|
) |
| const |
|
inline |
- Parameters
-
triIdx | [in] triangle index |
vtxIdx0,vtxIdx1,vtxIdx2 | [out] corner indices |
◆ getCustomIndex()
int GEOM_FADE25D::FadeExport::getCustomIndex |
( |
int |
vtxIdx | ) |
const |
|
inline |
- Returns
- the (optional) custom index of the vertex with the index
vtxIdx
or -1 if the vertex indices have not been exported.
◆ getNormal()
void GEOM_FADE25D::FadeExport::getNormal |
( |
int |
triIdx, |
|
|
double & |
x, |
|
|
double & |
y, |
|
|
double & |
z |
|
) |
| const |
This method retrieves the normal vector of the triangle.
- Parameters
-
| triIdx | [in] The index of the triangle. |
[out] | x,y,z | The components of the normal vector. |
◆ lexiSort()
void GEOM_FADE25D::FadeExport::lexiSort |
( |
| ) |
|
This method sorts the points in lexicographical order for better reproducibility. It is mainly used for consistent output in tests or exports.
◆ print()
void GEOM_FADE25D::FadeExport::print |
( |
| ) |
const |
|
inline |
Prints the points, triangles, and their adjacency relationships for inspection.
◆ reset()
void GEOM_FADE25D::FadeExport::reset |
( |
| ) |
|
|
inline |
Deletes all dynamically allocated data and resets the number of points, triangles, and custom indices to 0.
◆ writeObj()
bool GEOM_FADE25D::FadeExport::writeObj |
( |
const char * |
filename | ) |
const |
|
inline |
This method exports the triangulation to the popular .obj
file format, which is supported by most 3D viewers.
- Parameters
-
filename | The name of the file to write to. |
- Returns
true
if the file was successfully written, false
otherwise.
The documentation for this struct was generated from the following file: