RobWorkProject  23.9.11-
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Object3DGeneric Class Referenceabstract

An abstract 3d object consisting of geometry information, material and texture. More...

#include <Object3D.hpp>

Inherits TriMesh.

Inherited by Object3D< T >.

Classes

struct  MaterialMapData
 Mapping from triangles to materials. More...
 
struct  MaterialPolys
 ordering polygons by material consumes more memmory but reduce switches between textures. All indices _subFaces share material _matIndex. More...
 

Public Types

typedef rw::core::Ptr< Object3DGenericPtr
 Smart pointer type for Object3DGeneric.
 
- 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

virtual ~Object3DGeneric ()
 destructor
 
bool hasTexture () const
 test if the object is textured
 
void setMaterial (std::size_t material)
 set the material used by addTriangles More...
 
virtual std::size_t countFaces () const =0
 Get the number of faces. More...
 
virtual std::vector< rw::math::Vector3D< float > > getFaceVertices (size_t idx) const =0
 Returns vertices corresponding to the idx face. More...
 
virtual rw::geometry::Triangle< double > getTriangle (size_t idx) const =0
 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 GeometryType getType () const
 the type of this primitive
 
virtual Object3DGeneric::Ptr copy () const =0
 
- Public Member Functions inherited from TriMesh
virtual ~TriMesh ()
 destructor
 
virtual size_t getSize () const
 gets the number of triangles in the triangle array.
 
virtual size_t size () const =0
 gets the number of triangles in the triangle array.
 
virtual rw::core::Ptr< TriMeshclone () const =0
 make a clone of this triangle mesh More...
 
virtual void scale (double scale)=0
 Scale all vertices in the mesh.
 
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.
 

Public Attributes

std::string _name
 name/id of object
 
int _parentObj
 index of parent object
 
bool _hasTexture
 true if any of the materials used has texture
 
std::vector< rw::math::Vector3D< float > > _vertices
 Vertice array.
 
std::vector< rw::math::Vector3D< float > > _normals
 Normal array, there must be exactly one normal per vertex.
 
std::vector< rw::math::Vector2D< float > > _texCoords
 Texture coordinate array, the texture coordinates can be mapped to either vertices or faces. The reason for this is that often vertices share two or more texcoordinates and if mapping directly to vertices then additional vertices is necessary.
 
bool _mappedToFaces
 if true then the tex coodinates are mapped to faces and not vertices. if false then the texCoords are mapped to each vertice
 
rw::math::Transform3D< float > _transform
 Transform of the object.
 
std::vector< Object3DGeneric::Ptr_kids
 Child objects.
 
rw::math::Vector2D< float > _texOffset
 Offset of texture.
 
rw::math::Vector2D< float > _texRepeat
 Repeat texture.
 
std::vector< MaterialMapData_materialMap
 maps material into a range of triangles.
 
std::vector< MaterialPolys::Ptr_matPolys
 Polygons ordered according to material.
 

Protected Member Functions

 Object3DGeneric (const std::string &name)
 constructor More...
 

Additional Inherited Members

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

Detailed Description

An abstract 3d object consisting of geometry information, material and texture.

To reduce memory, the geometry is implemented slightly differently for different mesh sizes. One of the concrete Object3D implementations should be used in practice.

Constructor & Destructor Documentation

◆ Object3DGeneric()

Object3DGeneric ( const std::string &  name)
inlineprotected

constructor

Parameters
name[in] name of object

Member Function Documentation

◆ countFaces()

virtual std::size_t countFaces ( ) const
pure virtual

Get the number of faces.

Returns
the number of faces.

Implemented in Object3D< T >.

◆ getFaceVertices()

virtual std::vector<rw::math::Vector3D<float> > getFaceVertices ( size_t  idx) const
pure virtual

Returns vertices corresponding to the idx face.

Parameters
idx[in] Index of the face
Returns
List with vertices

Implemented in Object3D< T >.

◆ getTriangle() [1/3]

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

gets the triangle at index idx.

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

Implements TriMesh.

Implemented in Object3D< T >.

◆ 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.

◆ setMaterial()

void setMaterial ( std::size_t  material)

set the material used by addTriangles

Parameters
material

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