CollisionLineSet Class Reference
#include <CollisionLineSet.h>
Inherits CollisionObject.

Classes | |
| struct | CollisionLine |
| Datatype for a single collision line. More... | |
Public Member Functions | |
| CollisionLineSet (std::string vrmlFile) | |
| CollisionLineSet (const std::vector< CollisionLineSet::CollisionLine * > lines) | |
| virtual | ~CollisionLineSet () |
| const std::vector < CollisionLineSet::CollisionLine * > & | getCollisionLines () const |
| virtual std::string | getType () |
Protected Member Functions | |
| virtual bool | canCheckCollision (CollisionObject *opponent) |
| virtual std::vector < CollisionData * > & | checkCollisionInternal (CollisionObject *opponent, std::vector< CollisionData * > &dst, bool changeOrder) |
| void | readCollisionLines (OSG::NodePtr n) |
| std::vector< CollisionData * > & | checkCollisionWithLineSet (CollisionLineSet *opponent, std::vector< CollisionData * > &dst, bool changeOrder) |
| std::vector< CollisionData * > & | checkCollisionWithCircle (CollisionCircle *opponent, std::vector< CollisionData * > &dst, bool changeOrder) |
| bool | checkCollisionWithCircle (CollisionData *&result, CollisionLine *line, CollisionCircle *circle, bool changeOrder) |
Protected Attributes | |
| std::vector< CollisionLine * > | collisionLines |
| List of all CollisionLines defining the shape of the CollisionObject. | |
Constructor & Destructor Documentation
| CollisionLineSet::CollisionLineSet | ( | std::string | vrmlFile | ) |
Constructor parses collisionLines from VRML-file. The constructor reads the model from the VRML-file via OpenSG-commands and then parses the loaded model for lines which are then added to the list of collision lines.
| CollisionLineSet::CollisionLineSet | ( | const std::vector< CollisionLineSet::CollisionLine * > | lines | ) |
Constructor to copy an existing CollisionLine set. This constructor takes an array of CollisionLine*s and copies them for internal use.
- Parameters:
-
lines An array of CollisionLines
| CollisionLineSet::~CollisionLineSet | ( | ) | [virtual] |
Empty destructor.
Member Function Documentation
| bool CollisionLineSet::canCheckCollision | ( | CollisionObject * | opponent | ) | [protected, virtual] |
Checks if a collision-method is implemented for a collision check between the current CollisionObject and the passed one. Internally it checks the name of the passed CollisionObject and returns if a method exists locally to check for collisions.
- Parameters:
-
opponent CollisionObject for which a collision-method is searched
- Returns:
- true if a collision-method is implemented in this class, false otherwise
Implements CollisionObject.
| std::vector< CollisionData * > & CollisionLineSet::checkCollisionInternal | ( | CollisionObject * | opponent, | |
| std::vector< CollisionData * > & | dst, | |||
| bool | changeOrder | |||
| ) | [protected, virtual] |
Calculates the collisions between the passed CollisionObject and itself.
- Parameters:
-
opponent CollisionObject to check the collision with dst Destination vector where to write the collision information to changeOrder Defines order of CollisionObjects in CollisionData
- Returns:
- Destination vector (same as second parameter)
Implements CollisionObject.
| bool CollisionLineSet::checkCollisionWithCircle | ( | CollisionData *& | result, | |
| CollisionLine * | line, | |||
| CollisionCircle * | circle, | |||
| bool | changeOrder | |||
| ) | [protected] |
Searches for a collision between a single line and the passed CollisionCircle. The checks if the passed CollisionLine collides with the passed CollisionCircle. If so a CollisionData object is created and returned to the caller (which is the checkCollisionWithCircle method).
- Parameters:
-
result CollisionData where the collision info is stored if found line CollisionLine which should be checked for collision circle CollisionCircle which should be checked for collision changeOrder Defines order of CollisionObjects in CollisionData
- Returns:
- true if a collision was found, false otherwise
- Todo:
- : CODE SHOULD CONTAIN MORE COMMENTS, USE BETTER VARIABLE NAMES AND ALL IN ENGLISH IF POSSIBLE
| std::vector< CollisionData * > & CollisionLineSet::checkCollisionWithCircle | ( | CollisionCircle * | opponent, | |
| std::vector< CollisionData * > & | dst, | |||
| bool | changeOrder | |||
| ) | [protected] |
Searches for collisions between the CollisionLineSet and the passed CollisionCircle. The method is called from the checkCollisionInternal method and does the collision test between the CollisionLineSet and the passed CollisionCircle. It therefore calls for each collision line the checkCollisionWithCircle method.
- Parameters:
-
opponent CollisionCircle to check the collision with dst Destination vector where to write the collision information to changeOrder Defines order of CollisionObjects in CollisionData
- Returns:
- Destination vector (same as second parameter)
| std::vector< CollisionData * > & CollisionLineSet::checkCollisionWithLineSet | ( | CollisionLineSet * | opponent, | |
| std::vector< CollisionData * > & | dst, | |||
| bool | changeOrder | |||
| ) | [protected] |
Searches for collisions between two CollisionLineSets. The method is called from the checkCollisionInternal method and does the collision test between this CollisionLineSet and the passed one. Note: if possible, the opponent should be the CollisionLineSet with more lines.
- Parameters:
-
opponent CollisionLineSet to check the collision with dst Destination vector where to write the collision information changeOrder Defines order of CollisionObjects in CollisionData
- Returns:
- Destination vector (same as second parameter)
- Todo:
- Test checkCollisionWithLineSet
| const std::vector< CollisionLineSet::CollisionLine * > & CollisionLineSet::getCollisionLines | ( | ) | const |
Get a vector containing all collision lines.
| std::string CollisionLineSet::getType | ( | ) | [virtual] |
Returns the name of the CollisionObject (="CollisionLineSet"). The method returns the name of the CollisionObject. This name is normally equal to the classname of the CollisionObject. It is used in the checkCollision methods to identify the type of CollisionObject and to find the correct method for the collision test between two objects.
- Returns:
- Type of the CollisionObject (returns "CollisionLineSet").
Implements CollisionObject.
| void CollisionLineSet::readCollisionLines | ( | OSG::NodePtr | n | ) | [protected] |
Reads the collision lines from the passed OpenSG-tree. The method reads the lines from each Geometry core found in the passed OpenSG-tree and stores this lines in the collisionLines-list.
- Parameters:
-
n OpenSG-Tree containing the collision lines
Member Data Documentation
std::vector<CollisionLine*> CollisionLineSet::collisionLines [protected] |
List of all CollisionLines defining the shape of the CollisionObject.
The documentation for this class was generated from the following files:
- tools/libraries/CollisionMap/CollisionLineSet.h
- tools/libraries/CollisionMap/CollisionLineSet.cpp
Generated on Wed Oct 20 16:11:54 2010 for inVRs by
1.5.8