RobWorkProject
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Geometry Class Reference

a class for representing a geometry that is scaled and transformed, and which is attached to a frame. More...

#include <Geometry.hpp>

Public Types

enum  GeometryGroupMask {
  PhysicalGroup =1, VirtualGroup =2, DrawableGroup =4, CollisionGroup =8,
  User1Group =1024, User2Group =2048, User3Group =4096, User4Group =8096,
  ALL =0xFFFFFFFF
}
 A geometry may belong to a specific group of geometries. These groups are used for fast exclude filtering of geometry data in collision detection, visualization and such. There are 4 predefined groups used by RobWork. More...
 
typedef rw::common::Ptr< GeometryPtr
 smart pointer type to this class
 
typedef rw::common::Ptr< const GeometryCPtr
 smart pointer type to this const class
 

Public Member Functions

 Geometry (GeometryData::Ptr data, double scale=1.0)
 constructor - autogenerated id from geometry type. More...
 
 Geometry (GeometryData::Ptr data, const std::string &name, double scale=1.00)
 constructor giving a specified id. More...
 
 Geometry (GeometryData::Ptr data, const rw::math::Transform3D<> &t3d, double scale=1.0)
 constructor - autogenerated id from geometry type. More...
 
virtual ~Geometry ()
 destructor
 
double getScale () const
 gets the scaling factor applied when using this geometry
 
void setScale (double scale)
 set the scaling factor that should be applied to this geometry when used. More...
 
void setTransform (const rw::math::Transform3D<> &t3d)
 set transformation
 
const rw::math::Transform3DgetTransform () const
 get transformation
 
GeometryData::Ptr getGeometryData ()
 get geometry data
 
const GeometryData::Ptr getGeometryData () const
 get geometry data
 
void setGeometryData (GeometryData::Ptr data)
 set transformation
 
const std::string & getName () const
 get name of this geometry
 
const std::string & getFilePath () const
 get file path of this geometry
 
const std::string & getId () const
 get identifier of this geometry
 
void setName (const std::string &name)
 set name of this geometry
 
void setFilePath (const std::string &name)
 set file path this geometry
 
void setId (const std::string &id)
 set identifier of this geometry
 
void setFrame (kinematics::Frame *frame)
 Set the reference frame. More...
 
kinematics::FramegetFrame ()
 Get the reference frame. More...
 
const kinematics::FramegetFrame () const
 Get the reference frame. More...
 
void setMask (int mask)
 Set the draw mask. More...
 
int getMask ()
 Get the draw mask. More...
 

Static Public Member Functions

static Geometry::Ptr makeSphere (double radi)
 util function for creating a Sphere geometry
 
static Geometry::Ptr makeBox (double x, double y, double z)
 util function for creating a Box geometry
 
static Geometry::Ptr makeCone (double height, double radiusTop, double radiusBot)
 util function for creating a Cone geometry
 
static Geometry::Ptr makeCylinder (float radius, float height)
 util function for creating a Cylinder geometry
 
static Geometry::Ptr makeGrid (int dim_x, int dim_y, double size_x=1.0, double size_y=1.0, const rw::math::Vector3D<> &xdir=rw::math::Vector3D<>::x(), const rw::math::Vector3D<> &ydir=rw::math::Vector3D<>::y())
 Construct a grid. More...
 

Detailed Description

a class for representing a geometry that is scaled and transformed, and which is attached to a frame.

Each geometry must have a unique ID. This is either auto generated or specified by user. The ids are used in collision detection and other algorithms where the object need an association other than its memory address.

Member Enumeration Documentation

◆ GeometryGroupMask

A geometry may belong to a specific group of geometries. These groups are used for fast exclude filtering of geometry data in collision detection, visualization and such. There are 4 predefined groups used by RobWork.

Enumerator
VirtualGroup 

A physical object in the scene.

DrawableGroup 

A virtual object, e.g. lines showing camera view angle.

CollisionGroup 

An object that is "just" a drawable.

User1Group 

An object that is also a CollisionObject.

User2Group 

User defined group 1...

User2

User3Group 

User3.

User4Group 

User4.

Constructor & Destructor Documentation

◆ Geometry() [1/3]

Geometry ( GeometryData::Ptr  data,
double  scale = 1.0 
)

constructor - autogenerated id from geometry type.

Parameters
data
scale

◆ Geometry() [2/3]

Geometry ( GeometryData::Ptr  data,
const std::string &  name,
double  scale = 1.00 
)

constructor giving a specified id.

Parameters
data[in] pointer to geometry data
name[in] Unique name to be assigned for the geometry
scale[in] scaling factor

◆ Geometry() [3/3]

Geometry ( GeometryData::Ptr  data,
const rw::math::Transform3D<> &  t3d,
double  scale = 1.0 
)

constructor - autogenerated id from geometry type.

Parameters
data[in] pointer to geometry data
t3d[in] transform
scale[in] scaling factor

Member Function Documentation

◆ getFrame() [1/2]

kinematics::Frame* getFrame ( )
inline

Get the reference frame.

Returns
the reference frame.

◆ getFrame() [2/2]

const kinematics::Frame* getFrame ( ) const
inline

Get the reference frame.

Returns
the reference frame.

◆ getMask()

int getMask ( )
inline

Get the draw mask.

Returns
the draw mask.

◆ makeGrid()

static Geometry::Ptr makeGrid ( int  dim_x,
int  dim_y,
double  size_x = 1.0,
double  size_y = 1.0,
const rw::math::Vector3D<> &  xdir = rw::math::Vector3D<>::x(),
const rw::math::Vector3D<> &  ydir = rw::math::Vector3D<>::y() 
)
static

Construct a grid.

Parameters
dim_x[in] number of cells in first direction.
dim_y[in] number of cells in second direction.
size_x[in] size of one cell.
size_y[in] size of one cell.
xdir[in] the direction of the first dimension.
ydir[in] the direction of the second dimension.
Returns
a new grid geometry.

◆ setFrame()

void setFrame ( kinematics::Frame frame)
inline

Set the reference frame.

Parameters
frame[in] new reference frame.

◆ setMask()

void setMask ( int  mask)
inline

Set the draw mask.

Parameters
mask[in] the draw mask.

◆ setScale()

void setScale ( double  scale)
inline

set the scaling factor that should be applied to this geometry when used.

Parameters
scale[in] scale factor

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