geolib2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
geo::Mesh Class Reference

#include <Mesh.h>

Public Member Functions

void add (const Mesh &mesh)
 
unsigned int addPoint (const geo::Vector3 &p)
 
unsigned int addPoint (double x, double y, double z)
 
void addTriangle (unsigned int i1, unsigned int i2, unsigned int i3)
 
void clear ()
 
bool empty () const
 
void filterOverlappingVertices ()
 
double getMaxRadius () const
 
const std::vector< geo::Vector3 > & getPoints () const
 
double getSquaredMaxRadius () const
 
Mesh getTransformed (const geo::Transform t) const
 
const std::vector< TriangleI > & getTriangleIs () const
 
const geo::Vector3 getTriangleNormal (unsigned int index) const
 Calculates the nornaml of a triangle in the mesh. More...
 
const std::vector< Triangle > & getTriangles () const
 
 Mesh ()
 
std::size_t size () const
 
virtual ~Mesh ()
 

Protected Member Functions

void invalidateCache ()
 

Protected Attributes

double max_radius_cache_
 Cached maximum radius. More...
 
double max_radius_squared_cache_
 Cached squared maximum radius. More...
 
std::vector< geo::Vector3points_
 Points of the mesh. More...
 
std::vector< Triangletriangles_cache_
 Cached output result. More...
 
std::vector< TriangleItriangles_i_
 Triangles of the mesh. More...
 

Detailed Description

Mesh storage.

Definition at line 25 of file Mesh.h.

Constructor & Destructor Documentation

◆ Mesh()

geo::Mesh::Mesh ( )

Definition at line 8 of file Mesh.cpp.

◆ ~Mesh()

geo::Mesh::~Mesh ( )
virtual

Definition at line 12 of file Mesh.cpp.

Member Function Documentation

◆ add()

void geo::Mesh::add ( const Mesh mesh)

Add a mesh to this mesh.

Parameters
meshMesh to add.

Definition at line 31 of file Mesh.cpp.

◆ addPoint() [1/2]

unsigned int geo::Mesh::addPoint ( const geo::Vector3 p)

Add a point to the mesh.

Parameters
pPoint to add.
Returns
Index of the point.

Definition at line 19 of file Mesh.cpp.

◆ addPoint() [2/2]

unsigned int geo::Mesh::addPoint ( double  x,
double  y,
double  z 
)

Add a point to the mesh.

Parameters
xX coordinate of the point to add.
yY coordinate of the point to add.
zZ coordinate of the point to add.
Returns
Index of the point.

Definition at line 15 of file Mesh.cpp.

◆ addTriangle()

void geo::Mesh::addTriangle ( unsigned int  i1,
unsigned int  i2,
unsigned int  i3 
)

Add a triangle to the mesh.

Parameters
i1First point of the triangle to add.
i2Second point of the triangle to add.
i3Third point of the triangle to add.

Definition at line 26 of file Mesh.cpp.

◆ clear()

void geo::Mesh::clear ( )
inline

Empty the mesh.

Definition at line 76 of file Mesh.h.

◆ empty()

bool geo::Mesh::empty ( ) const
inline

Test whether the mesh is empty.

Returns
True if there are no triangles in the mesh (else false).

Definition at line 67 of file Mesh.h.

◆ filterOverlappingVertices()

void geo::Mesh::filterOverlappingVertices ( )

Filter overlapping vertices from the mesh.

Definition at line 84 of file Mesh.cpp.

◆ getMaxRadius()

double geo::Mesh::getMaxRadius ( ) const

Get the maximum radius.

Deprecated:
Use getSquaredMaxRadius instead, as it is cheaper.
Returns
The maximum radius of the mesh.

Definition at line 125 of file Mesh.cpp.

◆ getPoints()

const std::vector< Vector3 > & geo::Mesh::getPoints ( ) const

Get the points of the mesh.

Returns
The points of the mesh.

Definition at line 42 of file Mesh.cpp.

◆ getSquaredMaxRadius()

double geo::Mesh::getSquaredMaxRadius ( ) const

Get the squared maximum radius.

Returns
The squared maximum radius of the mesh.

Definition at line 116 of file Mesh.cpp.

◆ getTransformed()

Mesh geo::Mesh::getTransformed ( const geo::Transform  t) const

Apply transformation to the mesh.

Parameters
tTransformation to apply.
Returns
The transformed mesh.

Definition at line 59 of file Mesh.cpp.

◆ getTriangleIs()

const std::vector< TriangleI > & geo::Mesh::getTriangleIs ( ) const

Get the triangles of the mesh.

Returns
The triangles of the mesh, using indices into the vector returned by getPoints..

Definition at line 46 of file Mesh.cpp.

◆ getTriangleNormal()

const geo::Vector3 geo::Mesh::getTriangleNormal ( unsigned int  index) const

Calculates the nornaml of a triangle in the mesh.

Parameters
indexIndez of the traingle
Returns
the calculated normal of the triangle

Definition at line 132 of file Mesh.cpp.

◆ getTriangles()

const std::vector< Triangle > & geo::Mesh::getTriangles ( ) const

Get the triangles of the mesh.

Returns
The triangles of the mesh with points in space.

Definition at line 50 of file Mesh.cpp.

◆ invalidateCache()

void geo::Mesh::invalidateCache ( )
inlineprotected

Clear cached computed results, as they have become invalid.

Definition at line 143 of file Mesh.h.

◆ size()

std::size_t geo::Mesh::size ( ) const
inline

Get the number of triangles of the mesh.

Returns
The number of triangles in the mesh.

Definition at line 73 of file Mesh.h.

Member Data Documentation

◆ max_radius_cache_

double geo::Mesh::max_radius_cache_
mutableprotected

Cached maximum radius.

Definition at line 133 of file Mesh.h.

◆ max_radius_squared_cache_

double geo::Mesh::max_radius_squared_cache_
mutableprotected

Cached squared maximum radius.

Definition at line 134 of file Mesh.h.

◆ points_

std::vector<geo::Vector3> geo::Mesh::points_
protected

Points of the mesh.

Definition at line 136 of file Mesh.h.

◆ triangles_cache_

std::vector<Triangle> geo::Mesh::triangles_cache_
mutableprotected

Cached output result.

Definition at line 140 of file Mesh.h.

◆ triangles_i_

std::vector<TriangleI> geo::Mesh::triangles_i_
protected

Triangles of the mesh.

Definition at line 138 of file Mesh.h.


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