World of Rigid Bodies (WoRB)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
WoRB::Ball Class Reference

Encapsulates a rigid body with geometry of a sphere. More...

#include <Utilities.h>

Inheritance diagram for WoRB::Ball:
Collaboration diagram for WoRB::Ball:

Public Member Functions

 Ball (Quaternion position, Quaternion orientation, Quaternion velocity, Quaternion angularVelocity, double radius, double mass)
 Creates a ball at the given location.
virtual RigidBodyGetBody ()
 Gets underlying rigid body.
virtual GeometryGetGeometry ()
 Gets underlying geometry.
virtual void Render (RenderType type)
 Draws the geometry.
virtual void RenderWireframe (double *transform)
 Draws the wireframe of the rigid body.

Static Private Attributes

static const int slices = 20
 Number of slices for glutSolidSphere()
static const int stacks = 20
 Number of stacks for glutSolidSphere()

Detailed Description

Encapsulates a rigid body with geometry of a sphere.

Definition at line 297 of file Utilities.h.


Constructor & Destructor Documentation

WoRB::Ball::Ball ( Quaternion  position,
Quaternion  orientation,
Quaternion  velocity,
Quaternion  angularVelocity,
double  radius,
double  mass 
) [inline]

Creates a ball at the given location.

Definition at line 308 of file Utilities.h.

References WoRB::RigidBody::Activate(), WoRB::GLUT_Renderer::ActiveColor, WoRB::Geometry::Body, WoRB::GLUT_Renderer::InactiveColor, WoRB::Sphere::Radius, WoRB::RigidBody::Set_XQVW(), and WoRB::Sphere::SetMass().

        {
            Body = this;

            Radius = radius;

            ActiveColor   = Colorf( 0.9f, 0.7f, 0.7f, 0.8f );
            InactiveColor = Colorf( 0.7f, 0.7f, 0.9f, 0.8f );

            SetMass( mass );

            Body->Set_XQVW( position, orientation, velocity, angularVelocity );
            Body->Activate ();
        }

Member Function Documentation

virtual RigidBody& WoRB::Ball::GetBody ( ) [inline, virtual]

Gets underlying rigid body.

Implements WoRB::GLUT_Renderer.

Definition at line 331 of file Utilities.h.

        {
            return *this;
        }
virtual Geometry& WoRB::Ball::GetGeometry ( ) [inline, virtual]

Gets underlying geometry.

Implements WoRB::GLUT_Renderer.

Definition at line 338 of file Utilities.h.

        { 
            return *this;
        }
virtual void WoRB::Ball::RenderWireframe ( double *  transform) [inline, virtual]

Draws the wireframe of the rigid body.

Implements WoRB::GLUT_Renderer.

Definition at line 372 of file Utilities.h.

References WoRB::Sphere::Radius, slices, and stacks.

        {
            GLTransform bodySpace( transform );
            glColor4f( 0.0f, 0.0f, 0.0f, 0.1f );
            glutWireSphere( Radius, slices, stacks );
        }

Field Documentation

const int WoRB::Ball::slices = 20 [static, private]

Number of slices for glutSolidSphere()

Definition at line 299 of file Utilities.h.

Referenced by Render(), and RenderWireframe().

const int WoRB::Ball::stacks = 20 [static, private]

Number of stacks for glutSolidSphere()

Definition at line 300 of file Utilities.h.

Referenced by Render(), and RenderWireframe().


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