Robotsystem from Robot Group Leipzig: Primitive Class Reference

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

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

# Primitive Class Reference

`#include <primitive.h>`

Inheritance diagram for Primitive:

[legend]
List of all members.

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

Definition at line 87 of file primitive.h.

## Public Types
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
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

## 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 |
Definition at line 93 of file primitive.h.

## Constructor & Destructor Documentation

Primitive | ( |  | ) |

| Definition at line 108 of file primitive.cpp.

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

| Definition at line 112 of file primitive.cpp.

## Member Function Documentation

dBodyID getBody | ( |  | ) | const

| returns ODE bodyID if there Definition at line 165 of file primitive.cpp.

dGeomID getGeom | ( |  | ) | const

| returns ODE geomID if there Definition at line 160 of file primitive.cpp.

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

| returns the assoziated osg primitive if there or 0 Implemented in InvisibleBox, InvisibleSphere, InvisibleCapsule, Plane, Box, Sphere, Capsule, Transform, and DummyPrimitive.

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

| returns the pose Definition at line 155 of file primitive.cpp.

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

| returns the position Definition at line 150 of file primitive.cpp.

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 InvisibleBox, InvisibleSphere, InvisibleCapsule, Plane, Box, Sphere, Capsule, Transform, and DummyPrimitive.

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

| set the pose of the primitive Definition at line 127 of file primitive.cpp.

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

| set the position of the primitive (orientation is preserved) Definition at line 118 of file primitive.cpp.

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

| Updates the OSG nodes with ODE coordinates. This function must be overloaded (usually calls setMatrix of OsgPrimitives) Implemented in InvisibleBox, InvisibleSphere, InvisibleCapsule, Plane, Box, Sphere, Capsule, Transform, and DummyPrimitive.

## Member Data Documentation

dBodyID body`[protected]`

| Definition at line 131 of file primitive.h.

dGeomID geom`[protected]`

| Definition at line 130 of file primitive.h.

char mode`[protected]`

| Definition at line 132 of file primitive.h.