Mesh_analyzer
Loading...
Searching...
No Matches
Mesh Class Reference

A class representing a 3D mesh. More...

#include <mesh.h>

Public Member Functions

size_t countUniqueEdges () const
 Count the number of unique edges in the mesh by iterating through all triangles and adding their edges to an unordered_set.
float calculateAspectRatio (const Triangle &t) const
 Calculate the aspect ratio of a triangle defined by its vertex indices. An aspect ratio near to 1 indicates a more equilateral triangle.
void calculateAspectRatios ()
 Calculate the aspect ratio for all triangles in the mesh and store them in the ratios vector.
void analyzeMesh ()
 Analyze the mesh by printing out the number of vertices, triangles, and unique edges. Optionally, it could also calculate and print the aspect ratio of each triangle for quality analysis.
bool loadObj (const std::string &path)
 Load a mesh from an OBJ file using tinyobjloader.
std::unordered_map< Edge, int, EdgeHashgetEdgeValences () const
 Get the Edge Valences object.
std::vector< EdgegetBoundaryEdges () const
 Get the boundary edges of the mesh.
void smooth (int iterations, float lambda)
 Smooth the mesh by iteratively moving each vertex towards the centroid of its neighbors.

Public Attributes

std::vector< Pointvertices
 List of vertices in the mesh.
std::vector< Triangletriangles
 List of triangles defined by vertex indices.
std::vector< float > ratios
 aspect ratios of triangles (for quality analysis)

Detailed Description

A class representing a 3D mesh.

Member Function Documentation

◆ calculateAspectRatio()

float Mesh::calculateAspectRatio ( const Triangle & t) const

Calculate the aspect ratio of a triangle defined by its vertex indices. An aspect ratio near to 1 indicates a more equilateral triangle.

Parameters
t
Returns
float

◆ countUniqueEdges()

size_t Mesh::countUniqueEdges ( ) const

Count the number of unique edges in the mesh by iterating through all triangles and adding their edges to an unordered_set.

Returns
number of unique edges in the mesh

◆ getBoundaryEdges()

std::vector< Edge > Mesh::getBoundaryEdges ( ) const

Get the boundary edges of the mesh.

Returns
A vector containing the boundary edges

◆ getEdgeValences()

std::unordered_map< Edge, int, EdgeHash > Mesh::getEdgeValences ( ) const

Get the Edge Valences object.

Returns
std::unordered_map<Edge, int, EdgeHash>

◆ loadObj()

bool Mesh::loadObj ( const std::string & path)

Load a mesh from an OBJ file using tinyobjloader.

Parameters
pathPath to the OBJ file to load
Returns
true
false

◆ smooth()

void Mesh::smooth ( int iterations,
float lambda )

Smooth the mesh by iteratively moving each vertex towards the centroid of its neighbors.

Parameters
iterationsNumber of smoothing iterations to perform
lambdaSmoothing parameter (0 < lambda < 1)

The documentation for this class was generated from the following files: