#include <robot.h>
Public Member Functions | |
CGeometry () | |
void | init (CRobot *robot, char *filename) |
Initializes the geometry model. | |
void | cleanUp () |
CBox | getBox (int id) |
void | setBox (int id, CBox &box) |
CBox | getBoxRobotSpace (int id) |
Returns a representation of the box in robot space. | |
int | checkCollisions (int &first, int &second) |
Tests if two or more cubic base elements overlap. | |
bool | xmlToCollision (TiXmlElement *boxNode, CRobot *robot) |
Parses the <COLLISION>s (xml objects). | |
Public Attributes | |
CBox | geometry [GEOMETRY_BOXCOUNT] |
Set of cubic base elements making up the geometry model. | |
int | length |
Number of elements in geometry. | |
bool | check [GEOMETRY_BOXCOUNT][GEOMETRY_BOXCOUNT] |
Signals for every pair of cubic base elements if a collision check should be performed. | |
Private Member Functions | |
bool | getCollision (CBox &obj1, CBox &obj2) |
Checks if the two boxes overlap. | |
bool | checkOverlapping (const CVec &axis, const CBox &first, const CBox &second) |
Checks if the projections of the first and second box on the axis intersect. | |
void | projection (const CBox &box, const CVec &axis, float &startpoint, float &endpoint) |
Calculates the start- and endpoint of the projection of the box on the axis. |
The robot is modelled as a set of cubic base elements (CBox), which are stored in the geometry array. The position and orientation of every box is determined by the frames associated with each box. The frames might be attached to a certain link of the robot and therefore will be moved if the robot is moved.
Provides functions to:
CGeometry::CGeometry | ( | ) |
Checks if the two boxes overlap.
bool CGeometry::checkOverlapping | ( | const CVec & | axis, | |
const CBox & | first, | |||
const CBox & | second | |||
) | [private] |
Checks if the projections of the first and second box on the axis intersect.
void CGeometry::projection | ( | const CBox & | box, | |
const CVec & | axis, | |||
float & | startpoint, | |||
float & | endpoint | |||
) | [private] |
Calculates the start- and endpoint of the projection of the box on the axis.
void CGeometry::init | ( | CRobot * | robot, | |
char * | filename | |||
) |
Initializes the geometry model.
robot | Robot structure, needed to initialize the local frame | |
filename | XML-file to load the model from |
void CGeometry::cleanUp | ( | ) |
CBox CGeometry::getBox | ( | int | id | ) |
void CGeometry::setBox | ( | int | id, | |
CBox & | box | |||
) |
CBox CGeometry::getBoxRobotSpace | ( | int | id | ) |
Returns a representation of the box in robot space.
int CGeometry::checkCollisions | ( | int & | first, | |
int & | second | |||
) |
Tests if two or more cubic base elements overlap.
first | Index of first overlapping box | |
second | Index of second overlapping box |
bool CGeometry::xmlToCollision | ( | TiXmlElement * | boxNode, | |
CRobot * | robot | |||
) |
Parses the <COLLISION>s (xml objects).
The <COLLISION> objects hold information about which box should be tested against which box in the collision check.
CBox CGeometry::geometry[GEOMETRY_BOXCOUNT] |
Set of cubic base elements making up the geometry model.
Number of elements in geometry.
bool CGeometry::check[GEOMETRY_BOXCOUNT][GEOMETRY_BOXCOUNT] |
Signals for every pair of cubic base elements if a collision check should be performed.