Robotsystem of the Robot Group Leipzig: Primitive Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Examples

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Primitive Class Reference

Interface class for primitives represented in the physical and graphical world. More...

`#include <primitive.h>`

Inherited by Box, Capsule, Cylinder, DummyPrimitive, HeightField, InvisibleBox, InvisibleCapsule, InvisibleSphere, Mesh, Plane, Sphere, and Transform.

Inheritance diagram for Primitive:

[legend]
List of all members.

## Public Types
| Body = 1
| Geom = 2
| Draw = 4
enum | Modes { Body = 1, Geom = 2, Draw = 4 }
| Body means that it is a dynamic object with a body. More...
## Public Member Functions
| Primitive ()
virtual | ~Primitive ()
virtual void | init (const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Body|Geom|Draw)=0
| registers primitive in ODE and OSG.
virtual void | update ()=0
| Updates the OSG nodes with ODE coordinates.
virtual OSGPrimitive * | getOSGPrimitive ()=0
| returns the assoziated osg primitive if there or 0
virtual void | setTexture (const std::string &filename)
| assigns a texture to the primitive
virtual void | setTexture (const std::string &filename, bool repeatOnX, bool repeatOnY)
| assigns a texture to the primitive, you can choose if the texture should be repeated
void | setPosition (const osg::Vec3 &pos)
| set the position of the primitive (orientation is preserved)
void | setPose (const osg::Matrix &pose)
| set the pose of the primitive
osg::Vec3 | getPosition () const
| returns the position
osg::Matrix | getPose () const
| returns the pose
dGeomID | getGeom () const
| returns ODE geomID if there
dBodyID | getBody () const
| returns ODE bodyID if there
## Protected Attributes
dGeomID | geom
dBodyID | body
char | mode

## Detailed Description

Interface class for primitives represented in the physical and graphical world.

This is intended to bring OSG and ODE together and hide most implementation details.

## Member Enumeration Documentation

enum Modes

Body means that it is a dynamic object with a body.

Geom means it has a geometrical represenation used for collision detection. Draw means the primitive is drawn

Enumerator:

  Body |
  Geom |
  Draw |

## Constructor & Destructor Documentation

Primitive | ( |  | ) |

~Primitive | ( |  | ) | `[virtual]`

## Member Function Documentation

dBodyID getBody | ( |  | ) | const

returns ODE bodyID if there

dGeomID getGeom | ( |  | ) | const

returns ODE geomID if there

virtual OSGPrimitive* getOSGPrimitive | ( |  | ) | `[pure virtual]`

returns the assoziated osg primitive if there or 0

Implemented in HeightField, InvisibleBox, InvisibleSphere, InvisibleCapsule, Plane, Box, Sphere, Capsule, Cylinder, Mesh, Transform, and DummyPrimitive.

osg::Matrix getPose | ( |  | ) | const

returns the pose

osg::Vec3 getPosition | ( |  | ) | const

returns the position

virtual void init | ( | const OdeHandle & | odeHandle,
|  | double | mass,
|  | const OsgHandle & | osgHandle,
|  | char | mode = `Body|Geom|Draw` |
| ) |  |  | `[pure virtual]`

registers primitive in ODE and OSG.

Parameters:

  | osgHandle | scruct with ODE variables inside (to specify space, world...)
  | mass | Mass of the object in ODE (if withBody = true)
  | osgHandle | scruct with OSG variables inside (scene node, color ...)
  | mode | is a conjuction of Modes.

Implemented in HeightField, InvisibleBox, InvisibleSphere, InvisibleCapsule, Plane, Box, Sphere, Capsule, Cylinder, Mesh, Transform, and DummyPrimitive.

void setPose | ( | const osg::Matrix & | pose | ) |

set the pose of the primitive

Reimplemented in HeightField.

void setPosition | ( | const osg::Vec3 & | pos | ) |

set the position of the primitive (orientation is preserved)

void setTexture | ( | const std::string & | filename,
|  | bool | repeatOnX,
|  | bool | repeatOnY |
| ) |  |  | `[virtual]`

assigns a texture to the primitive, you can choose if the texture should be repeated

void setTexture | ( | const std::string & | filename | ) | `[virtual]`

assigns a texture to the primitive

virtual void update | ( |  | ) | `[pure virtual]`

Updates the OSG nodes with ODE coordinates.

This function must be overloaded (usually calls setMatrix of OsgPrimitives)

Implemented in HeightField, InvisibleBox, InvisibleSphere, InvisibleCapsule, Plane, Box, Sphere, Capsule, Cylinder, Mesh, Transform, and DummyPrimitive.

## Member Data Documentation

dBodyID body`[protected]`

dGeomID geom`[protected]`

char mode`[protected]`

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

- primitive.h
- primitive.cpp