RobWorkProject  23.9.11-
Public Types | Public Member Functions | List of all members
SimpleTriMesh Class Reference

A TriMesh with better interactions with the underlying data, and more capabilities. More...

#include <SimpleTriMesh.hpp>

Inherits TriMesh.

Public Types

using Ptr = rw::core::Ptr< SimpleTriMesh >
 
- Public Types inherited from TriMesh
typedef rw::core::Ptr< TriMeshPtr
 smart pointer type to this class
 
- Public Types inherited from GeometryData
enum  GeometryType {
  PointCloud , LineMesh , PlainTriMesh , IdxTriMesh ,
  SpherePrim , BoxPrim , OBBPrim , AABBPrim ,
  LinePrim , PointPrim , PyramidPrim , ConePrim ,
  TrianglePrim , CylinderPrim , TubePrim , PlanePrim ,
  RayPrim , Implicit , Quadratic , UserType
}
 geometry data types
 
typedef rw::core::Ptr< GeometryDataPtr
 smart pointer type to this class
 
typedef rw::core::Ptr< const GeometryDataCPtr
 const smart pointer type to this class
 

Public Member Functions

 SimpleTriMesh (TriMeshData::Ptr data=NULL)
 Construct an empty TriMesh if data is null else take ownership of data. More...
 
virtual ~SimpleTriMesh ()
 if the internal data object is not a shared pointer the data is deleted, when the destructor is called
 
 SimpleTriMesh (const SimpleTriMesh &copy)
 Copy the data from an existing trimesh. More...
 
 SimpleTriMesh (const SimpleTriMesh &&tmp)
 Transfere the data from a temporary TriMesh. This will simply copy the shared pointer to the data object. More...
 
 SimpleTriMesh (const rw::core::Ptr< SimpleTriMesh > &copy)
 Copy the data from an existing trimesh. More...
 
 SimpleTriMesh (const rw::geometry::TriMesh &copy)
 Copy the data from an existing trimesh. More...
 
 SimpleTriMesh (rw::geometry::GeometryData &copy)
 Copy the data from an existing trimesh. More...
 
 SimpleTriMesh (rw::geometry::GeometryData &&copy)
 Copy the data from an existing trimesh. More...
 
 SimpleTriMesh (const rw::core::Ptr< rw::geometry::GeometryData > &copy)
 Copy the data from an existing trimesh. More...
 
 SimpleTriMesh (const rw::core::Ptr< rw::geometry::TriMesh > &copy)
 Copy the data from an existing trimesh. More...
 
virtual rw::geometry::Triangle< double > getTriangle (size_t idx) const
 gets the triangle at index idx. More...
 
virtual void getTriangle (size_t idx, rw::geometry::Triangle< double > &dst) const
 gets the triangle at index idx. More...
 
virtual void getTriangle (size_t idx, rw::geometry::Triangle< float > &dst) const
 gets the triangle at index idx. Using Floating point presicion More...
 
virtual size_t size () const
 gets the number of triangles in the triangle array.
 
virtual rw::core::Ptr< TriMeshclone () const
 make a clone of this triangle mesh More...
 
virtual void scale (double scale)
 Scale all vertices in the mesh.
 
virtual void scale (const rw::math::Vector3D< double > &scale)
 Scale all vertices in the mesh. More...
 
virtual GeometryType getType () const
 the type of this primitive
 
virtual rw::core::Ptr< TriMeshgetTriMesh (bool forceCopy=true)
 gets a trimesh representation of this geometry data. More...
 
ReferencedTriangle triangle (size_t idx) const
 get triangle at index idx. Changes to the triangle will be reflected in this mesh More...
 
size_t triangles () const
 get number of triangles More...
 
ReferencedVertice vertice (size_t idx) const
 get vertice at index idx. Changes to the vertice will be reflected in this mesh More...
 
size_t vertices () const
 number of vertices in this mesh More...
 
void resize (size_t triangles, size_t vertices)
 Change the number of vertices and triangles in this mesh. More...
 
TriMeshData::Ptr getData () const
 get direct access to the data container
 
CSGEngine::Ptr getCSGEngine () const
 get the current CSGEngine More...
 
void setCSGEngine (CSGEngine::Ptr engine)
 set CSG engine More...
 
std::vector< SimpleTriMeshseparateMeshes () const
 Check if there are non-connected meshes inside this mesh. If ther are then seperate and return them. non-connected means that you have meshes that does not share a triangluar edge. More...
 
SimpleTriMesh combine (const SimpleTriMesh &mesh) const
 combine two meshes. OBS! this is not a union operation has all vertices and triangles are just directly copied over More...
 
SimpleTriMeshoperator*= (const rw::math::Transform3D< double > &trans)
 Move this TriMesh. More...
 
SimpleTriMesh operator* (const rw::math::Transform3D< double > &trans) const
 Create a copy of the TriMesh and move it. More...
 
SimpleTriMesh operator+ (const SimpleTriMesh &rhs) const
 Compute the Union of two TriMeshes, into a new TriMesh. More...
 
SimpleTriMeshoperator+= (const SimpleTriMesh &rhs)
 Compute the Union of two TriMeshes, into this TriMesh. More...
 
SimpleTriMesh operator- (const SimpleTriMesh &rhs) const
 Compute the Difference of two TriMeshes, into a new TriMesh. More...
 
SimpleTriMeshoperator-= (const SimpleTriMesh &rhs)
 Compute the Difference of two TriMeshes, into this TriMesh. More...
 
SimpleTriMesh operator& (const SimpleTriMesh &rhs) const
 Compute the Intersection of two TriMeshes, into a new TriMesh. More...
 
SimpleTriMeshoperator&= (const SimpleTriMesh &rhs)
 Compute the Intersection of two TriMeshes, into this TriMesh. More...
 
SimpleTriMesh operator^ (const SimpleTriMesh &rhs) const
 Compute the Symetric Difference of two TriMeshes, into a new TriMesh. More...
 
SimpleTriMeshoperator^= (const SimpleTriMesh &rhs)
 Compute the Symetric Difference of two TriMeshes, into this TriMesh. More...
 
SimpleTriMeshoperator= (TriMeshData::Ptr data)
 set the current data pointer equal to the new one More...
 
SimpleTriMeshoperator= (const SimpleTriMesh &copy)
 Copy the data from an existing trimesh. More...
 
SimpleTriMeshoperator= (const SimpleTriMesh &&tmp)
 Transfere the data from a temporary TriMesh. This will simply copy the shared pointer to the data object. More...
 
SimpleTriMeshoperator= (const rw::core::Ptr< SimpleTriMesh > &copy)
 Copy the data from an existing trimesh. More...
 
SimpleTriMeshoperator= (const rw::geometry::TriMesh &copy)
 Copy the data from an existing trimesh. More...
 
SimpleTriMeshoperator= (rw::geometry::GeometryData &copy)
 Copy the data from an existing trimesh. More...
 
SimpleTriMeshoperator= (rw::geometry::GeometryData &&copy)
 Copy the data from an existing trimesh. More...
 
SimpleTriMeshoperator= (const rw::core::Ptr< rw::geometry::GeometryData > &copy)
 Copy the data from an existing trimesh. More...
 
SimpleTriMeshoperator= (const rw::core::Ptr< rw::geometry::TriMesh > &copy)
 Copy the data from an existing trimesh. More...
 
- Public Member Functions inherited from TriMesh
virtual ~TriMesh ()
 destructor
 
virtual size_t getSize () const
 gets the number of triangles in the triangle array.
 
rw::core::Ptr< TriMeshgetTriMesh (bool forceCopy=true)
 gets a trimesh representation of this geometry data. More...
 
rw::core::Ptr< const TriMeshgetTriMesh (bool forceCopy=true) const
 gets a trimesh representation of this geometry data. More...
 
virtual bool isConvex ()
 test if this geometry data is convex More...
 
void setConvexEnabled (bool isConvex)
 
double getVolume () const
 calculate a volume of this triangle mesh
 
- Public Member Functions inherited from GeometryData
virtual ~GeometryData ()
 Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from GeometryData
static std::string toString (GeometryType type)
 format GeometryType to string More...
 

Detailed Description

A TriMesh with better interactions with the underlying data, and more capabilities.

Constructor & Destructor Documentation

◆ SimpleTriMesh() [1/9]

SimpleTriMesh ( TriMeshData::Ptr  data = NULL)

Construct an empty TriMesh if data is null else take ownership of data.

Parameters
data[in] the data to take ownership of. If now shared pointer, then the destructor cleans it up

◆ SimpleTriMesh() [2/9]

SimpleTriMesh ( const SimpleTriMesh copy)

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ SimpleTriMesh() [3/9]

SimpleTriMesh ( const SimpleTriMesh &&  tmp)

Transfere the data from a temporary TriMesh. This will simply copy the shared pointer to the data object.

Parameters
tmpthe object to take the data from

◆ SimpleTriMesh() [4/9]

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ SimpleTriMesh() [5/9]

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ SimpleTriMesh() [6/9]

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ SimpleTriMesh() [7/9]

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ SimpleTriMesh() [8/9]

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ SimpleTriMesh() [9/9]

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

Member Function Documentation

◆ clone()

virtual rw::core::Ptr<TriMesh> clone ( ) const
virtual

make a clone of this triangle mesh

Returns
clone of this trimesh

Implements TriMesh.

◆ combine()

SimpleTriMesh combine ( const SimpleTriMesh mesh) const

combine two meshes. OBS! this is not a union operation has all vertices and triangles are just directly copied over

Parameters
mesh[in] the mesh, that his mesh should be combined with
Returns
the resulting trimesh

◆ getCSGEngine()

CSGEngine::Ptr getCSGEngine ( ) const
inline

get the current CSGEngine

Returns
Null if none is found else a pointer to the engine

◆ getTriangle() [1/3]

virtual rw::geometry::Triangle<double> getTriangle ( size_t  idx) const
virtual

gets the triangle at index idx.

Parameters
idx[in] the index of the triangle.
Returns
the triangle at index idx

Implements TriMesh.

◆ getTriangle() [2/3]

virtual void getTriangle ( size_t  idx,
rw::geometry::Triangle< double > &  dst 
) const
virtual

gets the triangle at index idx.

Parameters
idx[in] the index of the triangle.
dst[out] where to store the triangle at index idx

Implements TriMesh.

◆ getTriangle() [3/3]

virtual void getTriangle ( size_t  idx,
rw::geometry::Triangle< float > &  dst 
) const
virtual

gets the triangle at index idx. Using Floating point presicion

Parameters
idx[in] the index of the triangle.
dst[out] where to store the triangle at index idx

Implements TriMesh.

◆ getTriMesh()

virtual rw::core::Ptr<TriMesh> getTriMesh ( bool  forceCopy = true)
virtual

gets a trimesh representation of this geometry data.

The trimesh that is returned is by default a copy, which means ownership is transfered to the caller. Specifying forceCopy to false will enable copy by reference and ownership is not necesarilly transfered. This is more efficient, though pointer is only alive as long as this GeometryData is alive.

Returns
TriMesh representation of this GeometryData

Implements GeometryData.

◆ operator&()

SimpleTriMesh operator& ( const SimpleTriMesh rhs) const

Compute the Intersection of two TriMeshes, into a new TriMesh.

Parameters
rhs[in] the TriMesh to create a Intersection with
Exceptions
rw::core::Exceptionif no CSGEngine can be found
Returns
a new TriMesh of the Intersection

◆ operator&=()

SimpleTriMesh& operator&= ( const SimpleTriMesh rhs)

Compute the Intersection of two TriMeshes, into this TriMesh.

Parameters
rhs[in] the TriMesh to create a Intersection with
Exceptions
rw::core::Exceptionif no CSGEngine can be found
Returns
a reference to the result

◆ operator*()

SimpleTriMesh operator* ( const rw::math::Transform3D< double > &  trans) const

Create a copy of the TriMesh and move it.

Parameters
trans[in] apply this transform to all vertices.
Returns
a new TriMesh

◆ operator*=()

SimpleTriMesh& operator*= ( const rw::math::Transform3D< double > &  trans)

Move this TriMesh.

Parameters
trans[in] apply this transform to all vertices.
Returns
a reference to this TriMesh.

◆ operator+()

SimpleTriMesh operator+ ( const SimpleTriMesh rhs) const

Compute the Union of two TriMeshes, into a new TriMesh.

Parameters
rhs[in] the TriMesh to create a union with
Exceptions
rw::core::Exceptionif no CSGEngine can be found
Returns
a new TriMesh of the union

◆ operator+=()

SimpleTriMesh& operator+= ( const SimpleTriMesh rhs)

Compute the Union of two TriMeshes, into this TriMesh.

Parameters
rhs[in] the TriMesh to create a union with
Exceptions
rw::core::Exceptionif no CSGEngine can be found
Returns
a reference to the result

◆ operator-()

SimpleTriMesh operator- ( const SimpleTriMesh rhs) const

Compute the Difference of two TriMeshes, into a new TriMesh.

Parameters
rhs[in] the TriMesh to create a difference with
Exceptions
rw::core::Exceptionif no CSGEngine can be found
Returns
a new TriMesh of the difference

◆ operator-=()

SimpleTriMesh& operator-= ( const SimpleTriMesh rhs)

Compute the Difference of two TriMeshes, into this TriMesh.

Parameters
rhs[in] the TriMesh to create a Difference with
Exceptions
rw::core::Exceptionif no CSGEngine can be found
Returns
a reference to the result

◆ operator=() [1/9]

SimpleTriMesh& operator= ( const rw::core::Ptr< rw::geometry::GeometryData > &  copy)

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ operator=() [2/9]

SimpleTriMesh& operator= ( const rw::core::Ptr< rw::geometry::TriMesh > &  copy)

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ operator=() [3/9]

SimpleTriMesh& operator= ( const rw::core::Ptr< SimpleTriMesh > &  copy)

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ operator=() [4/9]

SimpleTriMesh& operator= ( const rw::geometry::TriMesh copy)

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ operator=() [5/9]

SimpleTriMesh& operator= ( const SimpleTriMesh &&  tmp)

Transfere the data from a temporary TriMesh. This will simply copy the shared pointer to the data object.

Parameters
tmpthe object to take the data from

◆ operator=() [6/9]

SimpleTriMesh& operator= ( const SimpleTriMesh copy)

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ operator=() [7/9]

SimpleTriMesh& operator= ( rw::geometry::GeometryData &&  copy)

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ operator=() [8/9]

SimpleTriMesh& operator= ( rw::geometry::GeometryData copy)

Copy the data from an existing trimesh.

Parameters
copythe object to be copied

◆ operator=() [9/9]

SimpleTriMesh& operator= ( TriMeshData::Ptr  data)

set the current data pointer equal to the new one

Parameters
data[in] the data to take ownership of. If not shared pointer, then the destructor cleans it up

◆ operator^()

SimpleTriMesh operator^ ( const SimpleTriMesh rhs) const

Compute the Symetric Difference of two TriMeshes, into a new TriMesh.

Parameters
rhs[in] the TriMesh to create a Symetric Difference with
Exceptions
rw::core::Exceptionif no CSGEngine can be found
Returns
a new TriMesh of the Symetric Difference

◆ operator^=()

SimpleTriMesh& operator^= ( const SimpleTriMesh rhs)

Compute the Symetric Difference of two TriMeshes, into this TriMesh.

Parameters
rhs[in] the TriMesh to create a Symetric Difference with
Exceptions
rw::core::Exceptionif no CSGEngine can be found
Returns
a reference to the result

◆ resize()

void resize ( size_t  triangles,
size_t  vertices 
)

Change the number of vertices and triangles in this mesh.

Parameters
trianglesthe amount of triangles in the mesh
verticesthe amount of vertices in the mesh

◆ scale()

virtual void scale ( const rw::math::Vector3D< double > &  scale)
virtual

Scale all vertices in the mesh.

Parameters
scale[in] how each axis should be scaled.

◆ separateMeshes()

std::vector<SimpleTriMesh> separateMeshes ( ) const

Check if there are non-connected meshes inside this mesh. If ther are then seperate and return them. non-connected means that you have meshes that does not share a triangluar edge.

Returns
if no seperate meshes return this mesh. Else seperate the Meshes and return them.

◆ setCSGEngine()

void setCSGEngine ( CSGEngine::Ptr  engine)
inline

set CSG engine

Parameters
engine[in] pointer to the new engine

◆ triangle()

ReferencedTriangle triangle ( size_t  idx) const

get triangle at index idx. Changes to the triangle will be reflected in this mesh

Parameters
idxindex of the triangle
Returns
ReferencedTriangle

◆ triangles()

size_t triangles ( ) const

get number of triangles

Returns
size_t

◆ vertice()

ReferencedVertice vertice ( size_t  idx) const

get vertice at index idx. Changes to the vertice will be reflected in this mesh

Parameters
idxthe index of the wanted vertice
Returns
ReferencedVertice

◆ vertices()

size_t vertices ( ) const

number of vertices in this mesh

Returns
size_t

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