| 
    World of Rigid Bodies (WoRB)
   
    
   
   | 
  
  
  
 
Represents a geometry used to detect collisions against. More...
#include <Geometry.h>


Public Member Functions | |
| bool | IsCuboid () const | 
| bool | IsSphere () const | 
| bool | IsHalfSpace () const | 
| bool | IsTruePlane () const | 
| const char * | GetName () const | 
| Returns class of the geometry as a string.   | |
| Quaternion | Position () const | 
| Gets the position vector of the geometry.   | |
| Quaternion | Axis (unsigned index) const | 
| Gets the unit base vector (axes) of the geometry, given by the index.   | |
| void | Detect (CollisionResolver &owner, const Geometry *B) const | 
| Detects and registers a collision between this and the other geometry.   | |
Data Fields | |
| RigidBody * | Body | 
| The rigid body that is represented by this geometry.   | |
Protected Types | |
| enum | GeometryClass { _Sphere, _Cuboid, _HalfSpace, _TruePlane } | 
Protected Member Functions | |
| Geometry (GeometryClass type, RigidBody *body=0) | |
| Protected constructor; disallows explicit instantiation of the class.   | |
Protected Attributes | |
| GeometryClass | Class | 
| Holds the geometry class of the object.   | |
Represents a geometry used to detect collisions against.
Cannot be explicitly instantiated.
Definition at line 27 of file Geometry.h.
enum WoRB::Geometry::GeometryClass [protected] | 
        
Definition at line 31 of file Geometry.h.
        {
            _Sphere,
            _Cuboid,
            _HalfSpace,
            _TruePlane
        };
| WoRB::Geometry::Geometry | ( | GeometryClass | type, | 
| RigidBody * | body = 0  | 
        ||
| ) |  [inline, protected] | 
        
Protected constructor; disallows explicit instantiation of the class.
Definition at line 45 of file Geometry.h.
| Quaternion WoRB::Geometry::Axis | ( | unsigned | index | ) |  const [inline] | 
        
Gets the unit base vector (axes) of the geometry, given by the index.
Definition at line 88 of file Geometry.h.
References Body, WoRB::QTensor::Column(), and WoRB::RigidBody::ToWorld.
Referenced by WoRB::Cuboid::Check(), WoRB::Cuboid::Intersects(), WoRB::Cuboid::ProjectOn(), and WoRB::Cuboid::RegisterContactOnAxis().
| void Geometry::Detect | ( | CollisionResolver & | owner, | 
| const Geometry * | B | ||
| ) | const | 
Detects and registers a collision between this and the other geometry.
Definition at line 18 of file CollisionDetection.cpp.
References _Cuboid, _HalfSpace, _Sphere, _TruePlane, Class, and WoRB::CollisionResolver::HasSpaceForMoreContacts().
Referenced by WoRB::WorldOfRigidBodies< 256, 1024 >::SolveODE().
{
    if ( ! owner.HasSpaceForMoreContacts () ) {
        return;
    }
    typedef const Cuboid*     Cuboid_    ;
    typedef const Sphere*     Sphere_    ;
    typedef const HalfSpace*  HalfSpace_ ;
    typedef const TruePlane*  TruePlane_ ;
    switch( Class )
    {
        case _Sphere: switch( B->Class )
        {
            case _Sphere:    Sphere_(this)->Check( owner, *Sphere_(B)    ); break;
            case _Cuboid:    Cuboid_(B)   ->Check( owner, *Sphere_(this) ); break;
            case _HalfSpace: Sphere_(this)->Check( owner, *HalfSpace_(B) ); break;
            case _TruePlane: Sphere_(this)->Check( owner, *TruePlane_(B) ); break;
        }
        break;
        case _Cuboid: switch( B->Class )
        {
            case _Sphere:    Cuboid_(this)->Check( owner, *Sphere_(B)    ); break;
            case _Cuboid:    Cuboid_(this)->Check( owner, *Cuboid_(B)    ); break;
            case _HalfSpace: Cuboid_(this)->Check( owner, *HalfSpace_(B) ); break;
            case _TruePlane: /* not implemented */                        ; break;
        }
        break;
        case _HalfSpace: switch( B->Class )
        {
            case _Sphere:    Sphere_(B)->Check( owner, *HalfSpace_(this) ); break;
            case _Cuboid:    Cuboid_(B)->Check( owner, *HalfSpace_(this) ); break;
            case _HalfSpace: /* not implemented */                        ; break;
            case _TruePlane: /* not implemented */                        ; break;
        }
        break;
        case _TruePlane: switch( B->Class )
        {
            case _Sphere:    Sphere_(B)->Check( owner, *TruePlane_(this) ); break;
            case _Cuboid:    /* not implemented */                        ; break;
            case _HalfSpace: /* not implemented */                        ; break;
            case _TruePlane: /* not implemented */                        ; break;
        }
        break;
    }
}
| const char* WoRB::Geometry::GetName | ( | ) |  const [inline] | 
        
Returns class of the geometry as a string.
Definition at line 60 of file Geometry.h.
References _Cuboid, _HalfSpace, _Sphere, _TruePlane, and Class.
Referenced by WoRB_TestBed::Dump().
        {
            switch( Class )
            {
                case _Sphere:    return "Sphere";
                case _Cuboid:    return "Cuboid";
                case _HalfSpace: return "HalfSpace";
                case _TruePlane: return "TruePlane";
            }
            return "(unknown)";
        }
| bool WoRB::Geometry::IsCuboid | ( | ) |  const [inline] | 
        
Definition at line 53 of file Geometry.h.
References _Cuboid, and Class.
Referenced by WoRB_TestBed::Dump().
| bool WoRB::Geometry::IsHalfSpace | ( | ) |  const [inline] | 
        
Definition at line 55 of file Geometry.h.
References _HalfSpace, and Class.
{ return Class == _HalfSpace; }
| bool WoRB::Geometry::IsSphere | ( | ) |  const [inline] | 
        
Definition at line 54 of file Geometry.h.
References _Sphere, and Class.
Referenced by WoRB_TestBed::Dump().
| bool WoRB::Geometry::IsTruePlane | ( | ) |  const [inline] | 
        
Definition at line 56 of file Geometry.h.
References _TruePlane, and Class.
{ return Class == _TruePlane; }
| Quaternion WoRB::Geometry::Position | ( | ) |  const [inline] | 
        
Gets the position vector of the geometry.
Definition at line 79 of file Geometry.h.
References Body, WoRB::QTensor::Column(), and WoRB::RigidBody::ToWorld.
Referenced by WoRB::Sphere::Check(), WoRB::Cuboid::Check(), WoRB::Sphere::Intersects(), and WoRB::Cuboid::Intersects().
The rigid body that is represented by this geometry.
Null in case of a scenery object (like a half-plane).
Definition at line 75 of file Geometry.h.
Referenced by Axis(), WoRB::Ball::Ball(), WoRB::Box::Box(), WoRB::Sphere::Check(), WoRB::Cuboid::Check(), WoRB::WorldOfRigidBodies< MaxObjects, MaxCollisions >::RigidBodies::Exists(), WoRB::WorldOfRigidBodies< MaxObjects, MaxCollisions >::RigidBodies::Next(), WoRB::WorldOfRigidBodies< MaxObjects, MaxCollisions >::RigidBodies::operator->(), Position(), WoRB_TestBed::ReconfigureTestBed(), WoRB::Cuboid::RegisterContactOnAxis(), WoRB::Cuboid::RegisterContactOnAxis_Thorough(), WoRB::Ball::Render(), WoRB::Box::Render(), WoRB::WorldOfRigidBodies< MaxObjects, MaxCollisions >::RigidBodies::RigidBodies(), WoRB::Sphere::SetMass(), and WoRB::Cuboid::SetMass().
GeometryClass WoRB::Geometry::Class [protected] | 
        
Holds the geometry class of the object.
Definition at line 41 of file Geometry.h.
Referenced by Detect(), GetName(), IsCuboid(), IsHalfSpace(), IsSphere(), and IsTruePlane().