8#include <unordered_set>
9#include <unordered_map>
15#include "geometry/point.h"
16#include "geometry/edge.h"
17#include "geometry/triangle.h"
73 bool loadObj(
const std::string& path);
96 void smooth(
int iterations,
float lambda);
A class representing a 3D mesh.
Definition mesh.h:25
std::vector< float > ratios
aspect ratios of triangles (for quality analysis)
Definition mesh.h:30
std::vector< Point > vertices
List of vertices in the mesh.
Definition mesh.h:28
void smooth(int iterations, float lambda)
Smooth the mesh by iteratively moving each vertex towards the centroid of its neighbors.
Definition mesh.cpp:133
void calculateAspectRatios()
Calculate the aspect ratio for all triangles in the mesh and store them in the ratios vector.
Definition mesh.cpp:39
float calculateAspectRatio(const Triangle &t) const
Calculate the aspect ratio of a triangle defined by its vertex indices. An aspect ratio near to 1 ind...
Definition mesh.cpp:26
bool loadObj(const std::string &path)
Load a mesh from an OBJ file using tinyobjloader.
Definition mesh.cpp:63
std::unordered_map< Edge, int, EdgeHash > getEdgeValences() const
Get the Edge Valences object.
Definition mesh.cpp:104
void analyzeMesh()
Analyze the mesh by printing out the number of vertices, triangles, and unique edges....
Definition mesh.cpp:49
std::vector< Triangle > triangles
List of triangles defined by vertex indices.
Definition mesh.h:29
std::vector< Edge > getBoundaryEdges() const
Get the boundary edges of the mesh.
Definition mesh.cpp:121
size_t countUniqueEdges() const
Count the number of unique edges in the mesh by iterating through all triangles and adding their edge...
Definition mesh.cpp:9
A struct representing a triangle in the mesh.
Definition triangle.h:19