RobWorkProject  23.9.11-
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::core::Ptr< GeometryPtr
 smart pointer type to this class
 
typedef rw::core::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 More...
 
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 More...
 
const rw::math::Transform3DgetTransform () const
 get transformation More...
 
GeometryData::Ptr getGeometryData ()
 get geometry data More...
 
const GeometryData::Ptr getGeometryData () const
 get geometry data
 
void setGeometryData (GeometryData::Ptr data)
 set transformation More...
 
const std::string & getName () const
 get name of this geometry More...
 
const std::string & getFilePath () const
 get file path of this geometry More...
 
const std::string & getId () const
 get identifier of this geometry More...
 
void setName (const std::string &name)
 set name of this geometry More...
 
void setFilePath (const std::string &name)
 set file path this geometry More...
 
void setId (const std::string &id)
 set identifier of this geometry More...
 
void setColor (unsigned char red, unsigned char green, unsigned char blue)
 set the color of the geometry More...
 
void setColor (float red, float green, float blue)
 set the color of the geometry More...
 
void setFrame (rw::core::Ptr< rw::kinematics::Frame > frame)
 Set the reference frame. More...
 
rw::kinematics::FramegetFrame ()
 Get the reference frame. More...
 
const rw::kinematics::FramegetFrame () const
 Get the reference frame. More...
 
void setMask (int mask)
 Set the draw mask. More...
 
int getMask ()
 Get the draw mask. More...
 
void getColor (float color[3])
 get the color stored for the object 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< double > &xdir=rw::math::Vector3D< double >::x(), const rw::math::Vector3D< double > &ydir=rw::math::Vector3D< double >::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

◆ getColor()

void getColor ( float  color[3])
inline

get the color stored for the object

Parameters
color[out] the array to store the color in

◆ getFilePath()

const std::string& getFilePath ( ) const
inline

get file path of this geometry

Returns
the file path as string

◆ getFrame() [1/2]

rw::kinematics::Frame* getFrame ( )
inline

Get the reference frame.

Returns
the reference frame.

◆ getFrame() [2/2]

const rw::kinematics::Frame* getFrame ( ) const
inline

Get the reference frame.

Returns
the reference frame.

◆ getGeometryData()

GeometryData::Ptr getGeometryData ( )
inline

get geometry data

Returns
the geometry data stored

◆ getId()

const std::string& getId ( ) const
inline

get identifier of this geometry

Returns
the id of the geometry

◆ getMask()

int getMask ( )
inline

Get the draw mask.

Returns
the draw mask.

◆ getName()

const std::string& getName ( ) const
inline

get name of this geometry

Returns
name as string

◆ getScale()

double getScale ( ) const
inline

gets the scaling factor applied when using this geometry

Returns
the scale as double

◆ getTransform()

const rw::math::Transform3D& getTransform ( ) const
inline

get transformation

Returns
the Current transform

◆ 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< double > &  xdir = rw::math::Vector3D< double >::x(),
const rw::math::Vector3D< double > &  ydir = rw::math::Vector3D< double >::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.

◆ setColor() [1/2]

void setColor ( float  red,
float  green,
float  blue 
)

set the color of the geometry

Parameters
red[in] the amount of red color 0-1
green[in] the amount of green color 0-1
blue[in] the amount of red color 0-1

◆ setColor() [2/2]

void setColor ( unsigned char  red,
unsigned char  green,
unsigned char  blue 
)
inline

set the color of the geometry

Parameters
red[in] the amount of red color 0-255
green[in] the amount of green color 0-255
blue[in] the amount of red color 0-255

◆ setFilePath()

void setFilePath ( const std::string &  name)
inline

set file path this geometry

Parameters
name[in] path to a geometry file

◆ setFrame()

void setFrame ( rw::core::Ptr< rw::kinematics::Frame frame)
inline

Set the reference frame.

Parameters
frame[in] new reference frame.

◆ setGeometryData()

void setGeometryData ( GeometryData::Ptr  data)
inline

set transformation

Parameters
data[in] the new geometry data

◆ setId()

void setId ( const std::string &  id)
inline

set identifier of this geometry

Parameters
id[in] new id

◆ setMask()

void setMask ( int  mask)
inline

Set the draw mask.

Parameters
mask[in] the draw mask.

◆ setName()

void setName ( const std::string &  name)
inline

set name of this geometry

Parameters
name[in] the new name of the geometry

◆ setScale()

void setScale ( double  scale)
inline

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

Parameters
scale[in] scale factor

◆ setTransform()

void setTransform ( const rw::math::Transform3D<> &  t3d)
inline

set transformation

Parameters
t3d[in] the new transform

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