RobWorkProject  23.9.11-
Public Types | Public Member Functions | Protected Member Functions | List of all members
Primitive Class Referenceabstract

defines an interface for a geometric shape that is defined by a set of parameters. More...

#include <Primitive.hpp>

Inherits GeometryData.

Inherited by Box, Cone, Cylinder, Line, Plane, Pyramid, Sphere, Tube, and SimpleFinger.

Public Types

typedef rw::core::Ptr< PrimitivePtr
 Smart pointer to this type of 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 ~Primitive ()
 destructor
 
TriMesh::Ptr getTriMesh (bool forceCopy=true)
 gets a trimesh representation of this geometry data. More...
 
virtual TriMesh::Ptr createMesh (int resolution) const =0
 make a trimesh from this primitive. Use granularity to specify minimum number of line segments a half circle is split into More...
 
virtual rw::math::Q getParameters () const =0
 get the parameters that define this primitive
 
virtual void setParameters (const rw::math::Q &q)=0
 set the parameters that define this primitive
 
virtual bool isConvex ()
 test if this geometry data is convex More...
 
bool isInside (const rw::math::Vector3D< double > &point)
 test if a point is on the border or inside this primitive
 
- Public Member Functions inherited from GeometryData
virtual ~GeometryData ()
 Destructor.
 
virtual GeometryType getType () const =0
 the type of this primitive
 

Protected Member Functions

virtual bool doIsInside (const rw::math::Vector3D< double > &point)
 Check if point lies inside geometry. More...
 
 Primitive (int levels=20)
 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

defines an interface for a geometric shape that is defined by a set of parameters.

Constructor & Destructor Documentation

◆ Primitive()

Primitive ( int  levels = 20)
inlineprotected

Constructor.

Parameters
levels[in] mesh resolution.

Member Function Documentation

◆ createMesh()

virtual TriMesh::Ptr createMesh ( int  resolution) const
pure virtual

make a trimesh from this primitive. Use granularity to specify minimum number of line segments a half circle is split into

Parameters
resolution[in]

Implemented in SimpleFinger, Tube, Sphere, Ray, Pyramid, Plane, Line, Cylinder, Cone, and Box.

◆ doIsInside()

virtual bool doIsInside ( const rw::math::Vector3D< double > &  point)
inlineprotectedvirtual

Check if point lies inside geometry.

Parameters
point[in] point to check.
Returns
true if inside geometry, false otherwise.

Reimplemented in Tube, Sphere, Pyramid, Plane, Cone, and Box.

◆ getTriMesh()

TriMesh::Ptr getTriMesh ( bool  forceCopy = true)
inlinevirtual

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
Note
primitives allways return a new trimesh

Implements GeometryData.

◆ isConvex()

virtual bool isConvex ( )
inlinevirtual

test if this geometry data is convex

Returns
true if convex

Reimplemented from GeometryData.


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