DART 6.12.2
Loading...
Searching...
No Matches
dart::math::TriMesh< S_ > Class Template Reference

This class represents triangle meshes. More...

#include <TriMesh.hpp>

Inheritance diagram for dart::math::TriMesh< S_ >:
dart::math::Mesh< S_ > dart::math::Icosphere< S_ >

Public Types

using S = S_
 
using Base = Mesh< S >
 
using Index = typename Base::Index
 
using Vector3 = typename Base::Vector3
 
using Triangle = Eigen::Matrix< Index, 3, 1 >
 
using Vertices = typename Base::Vertices
 
using Normals = typename Base::Normals
 
using Triangles = std::vector< Triangle >
 
using Indices = std::vector< Index >
 

Public Member Functions

 TriMesh ()
 Default constructor.
 
 ~TriMesh () override=default
 Destructor.
 
void setTriangles (const Vertices &vertices, const Triangles &triangles)
 Sets vertices and triangles.
 
void computeVertexNormals ()
 Computes vertex normals.
 
bool hasTriangles () const
 Returns true if the mesh contains triangles.
 
bool hasTriangleNormals () const
 Returns true if the mesh contains triangle normals.
 
const TrianglesgetTriangles () const
 Returns the triangles of the mesh.
 
const NormalsgetTriangleNormals () const
 Returns the triangle normals of the mesh.
 
void clear () override
 Clears all the data in the trimesh.
 
TriMesh operator+ (const TriMesh &other) const
 Addition operator.
 
TriMeshoperator+= (const TriMesh &other)
 Addition assignment operator.
 
std::shared_ptr< TriMesh< S > > generateConvexHull (bool optimize=true) const
 Generates a convex hull that encloses the trimesh.
 
bool hasVertices () const
 Returns true if the mesh contains vertices.
 
bool hasVertexNormals () const
 Returns true if the mesh contains vertex normals.
 
const VerticesgetVertices () const
 Returns the vertices of the mesh.
 
const NormalsgetVertexNormals () const
 Returns the vertex normals of the mesh.
 
bool isEmpty () const
 Returns true if the mesh has no vertices.
 
void translate (const Vector3 &translation)
 Translates the mesh vertices by adding translation to the vertices.
 
Mesh operator+ (const Mesh &other) const
 Addition operator.
 
Meshoperator+= (const Mesh &other)
 Addition assignment operator.
 

Protected Member Functions

void computeTriangleNormals ()
 Computes triangle normals.
 
void normalizeTriangleNormals ()
 Normalizes triangle normals.
 
void normalizeVertexNormals ()
 Normalizes the vertex normals.
 

Protected Attributes

Triangles mTriangles
 Triangle indices of the mesh.
 
Normals mTriangleNormals
 Triangle normals of the mesh.
 
Vertices mVertices
 Vertices of the mesh.
 
Normals mVertexNormals
 Vertex normals of the mesh.
 

Detailed Description

template<typename S_>
class dart::math::TriMesh< S_ >

This class represents triangle meshes.

Member Typedef Documentation

◆ Base

template<typename S_ >
using dart::math::TriMesh< S_ >::Base = Mesh<S>

◆ Index

◆ Indices

template<typename S_ >
using dart::math::Mesh< S_ >::Indices = std::vector<Index>
inherited

◆ Normals

◆ S

template<typename S_ >
using dart::math::TriMesh< S_ >::S = S_

◆ Triangle

template<typename S_ >
using dart::math::TriMesh< S_ >::Triangle = Eigen::Matrix<Index, 3, 1>

◆ Triangles

template<typename S_ >
using dart::math::TriMesh< S_ >::Triangles = std::vector<Triangle>

◆ Vector3

◆ Vertices

Constructor & Destructor Documentation

◆ TriMesh()

template<typename S >
dart::math::TriMesh< S >::TriMesh ( )

Default constructor.

◆ ~TriMesh()

template<typename S_ >
dart::math::TriMesh< S_ >::~TriMesh ( )
overridedefault

Destructor.

Member Function Documentation

◆ clear()

template<typename S >
void dart::math::TriMesh< S >::clear ( )
overridevirtual

Clears all the data in the trimesh.

Reimplemented from dart::math::Mesh< S_ >.

◆ computeTriangleNormals()

template<typename S >
void dart::math::TriMesh< S >::computeTriangleNormals ( )
protected

Computes triangle normals.

◆ computeVertexNormals()

template<typename S >
void dart::math::TriMesh< S >::computeVertexNormals ( )

Computes vertex normals.

◆ generateConvexHull()

template<typename S >
std::shared_ptr< TriMesh< S > > dart::math::TriMesh< S >::generateConvexHull ( bool  optimize = true) const

Generates a convex hull that encloses the trimesh.

Parameters
[in]optimize(Optional) Whether to discard vertices that are not used in the convex hull.

◆ getTriangleNormals()

template<typename S >
const TriMesh< S >::Normals & dart::math::TriMesh< S >::getTriangleNormals ( ) const

Returns the triangle normals of the mesh.

◆ getTriangles()

template<typename S >
const TriMesh< S >::Triangles & dart::math::TriMesh< S >::getTriangles ( ) const

Returns the triangles of the mesh.

◆ getVertexNormals()

template<typename S >
const Mesh< S >::Normals & dart::math::Mesh< S >::getVertexNormals ( ) const
inherited

Returns the vertex normals of the mesh.

◆ getVertices()

template<typename S >
const Mesh< S >::Vertices & dart::math::Mesh< S >::getVertices ( ) const
inherited

Returns the vertices of the mesh.

◆ hasTriangleNormals()

template<typename S >
bool dart::math::TriMesh< S >::hasTriangleNormals ( ) const

Returns true if the mesh contains triangle normals.

◆ hasTriangles()

template<typename S >
bool dart::math::TriMesh< S >::hasTriangles ( ) const

Returns true if the mesh contains triangles.

◆ hasVertexNormals()

template<typename S >
bool dart::math::Mesh< S >::hasVertexNormals ( ) const
inherited

Returns true if the mesh contains vertex normals.

◆ hasVertices()

template<typename S >
bool dart::math::Mesh< S >::hasVertices ( ) const
inherited

Returns true if the mesh contains vertices.

◆ isEmpty()

template<typename S >
bool dart::math::Mesh< S >::isEmpty ( ) const
inherited

Returns true if the mesh has no vertices.

◆ normalizeTriangleNormals()

template<typename S >
void dart::math::TriMesh< S >::normalizeTriangleNormals ( )
protected

Normalizes triangle normals.

◆ normalizeVertexNormals()

template<typename S >
void dart::math::Mesh< S >::normalizeVertexNormals ( )
protectedinherited

Normalizes the vertex normals.

◆ operator+() [1/2]

template<typename S >
Mesh< S > dart::math::Mesh< S >::operator+ ( const Mesh< S_ > &  other) const
inherited

Addition operator.

◆ operator+() [2/2]

template<typename S >
TriMesh< S > dart::math::TriMesh< S >::operator+ ( const TriMesh< S_ > &  other) const

Addition operator.

◆ operator+=() [1/2]

template<typename S >
Mesh< S > & dart::math::Mesh< S >::operator+= ( const Mesh< S_ > &  other)
inherited

Addition assignment operator.

◆ operator+=() [2/2]

template<typename S >
TriMesh< S > & dart::math::TriMesh< S >::operator+= ( const TriMesh< S_ > &  other)

Addition assignment operator.

◆ setTriangles()

template<typename S >
void dart::math::TriMesh< S >::setTriangles ( const Vertices vertices,
const Triangles triangles 
)

Sets vertices and triangles.

◆ translate()

template<typename S >
void dart::math::Mesh< S >::translate ( const Vector3 translation)
inherited

Translates the mesh vertices by adding translation to the vertices.

Member Data Documentation

◆ mTriangleNormals

template<typename S_ >
Normals dart::math::TriMesh< S_ >::mTriangleNormals
protected

Triangle normals of the mesh.

◆ mTriangles

template<typename S_ >
Triangles dart::math::TriMesh< S_ >::mTriangles
protected

Triangle indices of the mesh.

◆ mVertexNormals

template<typename S_ >
Normals dart::math::Mesh< S_ >::mVertexNormals
protectedinherited

Vertex normals of the mesh.

◆ mVertices

template<typename S_ >
Vertices dart::math::Mesh< S_ >::mVertices
protectedinherited

Vertices of the mesh.