7#include <Eigen/Eigenvalues>
46 return (
v1 +
v2 +
v3) / 3.0f;
52 return 0.5f * ((
v2 -
v1).cross(
v3 -
v1)).norm();
61 bool read(
const std::string& filename);
Class to read STL files.
Definition STLReader.h:57
const std::vector< Triangle > & getTriangles() const
Get the triangles of the STL mesh.
bool readASCII(std::ifstream &file)
Read the ASCII STL file.
void removeTrianglesOutsideLimits(const Vector3d &min, const Vector3d &max)
Remove triangles that have all vertices outside the specified bounding box.
bool readBinary(std::ifstream &file)
Read the binary STL file.
bool read(const std::string &filename)
Read the STL file.
std::vector< Triangle > triangles
Vector containing the triangles.
Definition STLReader.h:75
Struct representing a triangle.
Definition STLReader.h:14
Vector3d v1
Definition STLReader.h:17
double getArea() const
Calculate the area of the triangle.
Definition STLReader.h:51
Vector3d getCentroid() const
Calculate the centroid of the triangle.
Definition STLReader.h:45
Vector3d normal
Normal vector of the triangle.
Definition STLReader.h:16
const Vector3d & getVertex2() const
Get the second vertex of the triangle.
Definition STLReader.h:27
const Vector3d & getVertex3() const
Get the third vertex of the triangle.
Definition STLReader.h:33
Vector3d getVertex1() const
Get the first vertex of the triangle.
Definition STLReader.h:21
Vector3d v2
Definition STLReader.h:17
Vector3d v3
Vertices of the triangle.
Definition STLReader.h:17
const Vector3d & getNormal() const
Get the normal of the triangle.
Definition STLReader.h:39