MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Mezzanine::Physics::Constraint Class Referenceabstract

This is the base class for all constraints supported. More...

#include <constraint.h>

+ Inheritance diagram for Mezzanine::Physics::Constraint:
+ Collaboration diagram for Mezzanine::Physics::Constraint:

Public Types

typedef std::vector< int > AxisList
 Used to Store lists of Int Axis for return types. More...
 
typedef std::vector
< ConstraintParam
ParamList
 Used to Store lists of param for return types.
 

Public Member Functions

virtual ~Constraint ()
 Class destructor. More...
 
virtual btTypedConstraint * GetConstraintBase () const =0
 Get the Bullet constraint that this class encapsulates. More...
 
virtual Real GetParam (ConstraintParam Param, int Axis=-1) const
 Gets value of constraint parameters. More...
 
virtual RigidProxyGetProxyA () const
 Gets the first Proxy this constraint applies to. More...
 
virtual RigidProxyGetProxyB () const
 Gets the second Proxy this constraint applies to. More...
 
virtual bool HasParamBeenSet (ConstraintParam Param, int Axis) const =0
 Has the given Param on the Given Axis been set yet. More...
 
virtual bool IsParamValidOnAxis (ConstraintParam Param, int Axis) const
 Is a certain Parameter valid on a certain axis. More...
 
virtual void ProtoDeSerialize (const XML::Node &OneNode)
 Take the data stored in an XML and overwrite this instance of this object with it. More...
 
virtual void ProtoSerialize (XML::Node &CurrentRoot) const
 Convert this class to an XML::Node ready for serialization. More...
 
virtual void SetParam (ConstraintParam Param, Real Value, int Axis=-1)
 Provides override of constraint parameters. More...
 
virtual AxisList ValidAngularAxis () const =0
 Get A list sorted (low to high) of all axis that operate Angularly (that lock sliding/translation) More...
 
virtual AxisList ValidAxis () const
 Get a sorted (low to high) list of All Valid Axis. More...
 
virtual AxisList ValidLinearAxis () const =0
 Get a sorted (low to high) list of all axis that operate linearly (that lock sliding/translation) More...
 
virtual ParamList ValidParamOnAxis (int Axis) const =0
 Get a sorted (low to high) list of Parameters that are valid on this Axis. More...
 
virtual ParamList ValidParams () const
 Get A sorted (low to high) list of Parameters that are valid on all Axis. More...
 

Static Public Member Functions

static String SerializableName ()
 Get the name of the the XML tag this class will leave behind as its instances are serialized. More...
 

Protected Member Functions

 Constraint ()
 No initialization constructor. More...
 
void SetBodies (RigidProxy *Prox1, RigidProxy *Prox2)
 Sets the Internal Proxy pointers. More...
 
void SetBodies (RigidProxy *Prox1)
 Sets the Internal Proxy pointers. More...
 

Protected Attributes

RigidProxyProxA
 The first Collidable this constraint applies to. More...
 
RigidProxyProxB
 The second Collidable this constraint applies to. More...
 

Friends

class PhysicsManager
 

Detailed Description

This is the base class for all constraints supported.

This class provides the basis for all the other constraints. This is also a virtual class and provides no constraint properties of it's own, thus shouldn't/can't be called on manually.

Any class implementing a this must implement at least these functions to create a minimally functiontal constraint:

It is advisable to re-implement a few more functions as well, these all have implementation writtens in terms of of the function that must be implemented, but the genericity of them may impede performance.

Definition at line 117 of file constraint.h.

Member Typedef Documentation

typedef std::vector<int> Mezzanine::Physics::Constraint::AxisList

Used to Store lists of Int Axis for return types.

In general Axis will come in groups of three, such as 0,1,2, or 0,1,2,3,4,5 which could represent X,Y, and Z or multiple grousp of X,Y, and Z. These Axis can represent Linear/Translation or Angular/Rotation information. Some Constraints support values that affect all constraints, this is usually represented a -1.

Definition at line 160 of file constraint.h.

Constructor & Destructor Documentation

Mezzanine::Physics::Constraint::Constraint ( )
protected

No initialization constructor.

This is protected to prevent creating an instance of this directly.

virtual Mezzanine::Physics::Constraint::~Constraint ( )
virtual

Class destructor.

The class destructor.

Member Function Documentation

virtual btTypedConstraint* Mezzanine::Physics::Constraint::GetConstraintBase ( ) const
pure virtual

Get the Bullet constraint that this class encapsulates.

Returns
A pointer to the btTypedConstraint that stores the underlying constraint.

Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::GearConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::ConeTwistConstraint.

virtual Real Mezzanine::Physics::Constraint::GetParam ( ConstraintParam  Param,
int  Axis = -1 
) const
virtual

Gets value of constraint parameters.

See SetParam() for clarification. Gets information on constraint parameters.

Parameters
Para,Theparameter to get information for.
AxisOptional axis.
Returns
Returns the value for the requested parameter.
virtual RigidProxy* Mezzanine::Physics::Constraint::GetProxyA ( ) const
virtual

Gets the first Proxy this constraint applies to.

Returns
Returns a pointer to the first Proxy this constraint applies to.
virtual RigidProxy* Mezzanine::Physics::Constraint::GetProxyB ( ) const
virtual

Gets the second Proxy this constraint applies to.

Returns
Returns a pointer to the second Proxy this constraint applies to.
virtual bool Mezzanine::Physics::Constraint::HasParamBeenSet ( ConstraintParam  Param,
int  Axis 
) const
pure virtual

Has the given Param on the Given Axis been set yet.

Parameters
ParamThe parameter to Check
AxisThe Axis on which to check the param

This will probably have to implement the same logic aas what is in the respective get/setparam function of each constraint http://bulletphysics.com/Bullet/BulletFull/classbtTypedConstraint.html#a11f44dd743b59bc05e25d500456e2559

Returns
True if it has been set, false if it has.

Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.

virtual bool Mezzanine::Physics::Constraint::IsParamValidOnAxis ( ConstraintParam  Param,
int  Axis 
) const
inlinevirtual

Is a certain Parameter valid on a certain axis.

Parameters
ParamThe Parameter to Check
AxisThe Axis to Check

This is implemented using ValidParamOnAxis, Derived versions of this class may wish to make a more specialized implementation of this method.

Returns
True if Param is valid on Axis, and Axis is valid. If anything is invalid this returns false.

Definition at line 200 of file constraint.h.

virtual void Mezzanine::Physics::Constraint::ProtoDeSerialize ( const XML::Node OneNode)
virtual

Take the data stored in an XML and overwrite this instance of this object with it.

Parameters
OneNodeand XML::Node containing the data.

This should only be run once all the actors have finishes being deserialized. This will fail if the actors it expects are not present.

Reimplemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::Generic6DofSpringConstraint, Mezzanine::Physics::Point2PointConstraint, Mezzanine::Physics::DualTransformConstraint, and Mezzanine::Physics::GearConstraint.

virtual void Mezzanine::Physics::Constraint::ProtoSerialize ( XML::Node CurrentRoot) const
virtual

Convert this class to an XML::Node ready for serialization.

Parameters
CurrentRootThe point in the XML hierarchy that all this vectorw should be appended to.

This stores each Actor's name and every constraint parameter on each if it has been set. This should allow for looking up the required actors in the Actor Manager. This should also prevent any interference with different values and minimize the size of the serialized version

Reimplemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::Generic6DofSpringConstraint, Mezzanine::Physics::Point2PointConstraint, Mezzanine::Physics::DualTransformConstraint, and Mezzanine::Physics::GearConstraint.

static String Mezzanine::Physics::Constraint::SerializableName ( )
static

Get the name of the the XML tag this class will leave behind as its instances are serialized.

Returns
A string containing "Constraint"
void Mezzanine::Physics::Constraint::SetBodies ( RigidProxy Prox1,
RigidProxy Prox2 
)
protected

Sets the Internal Proxy pointers.

void Mezzanine::Physics::Constraint::SetBodies ( RigidProxy Prox1)
protected

Sets the Internal Proxy pointers.

virtual void Mezzanine::Physics::Constraint::SetParam ( ConstraintParam  Param,
Real  Value,
int  Axis = -1 
)
virtual

Provides override of constraint parameters.

Parameters such as ERP(Error Reduction Parameter) and CFM(Constraint Force Mixing) can be altered with this function. Optionally provide axis.

Parameters
ParamThe parameter to override.
ValueThe new value for the parameter.
AxisOptional axis.
virtual AxisList Mezzanine::Physics::Constraint::ValidAngularAxis ( ) const
pure virtual

Get A list sorted (low to high) of all axis that operate Angularly (that lock sliding/translation)

Warning
Odd behaviors, maybe even undefined behavior can happen if This returns a matching Axis to a Linear Axis. Any given axis should only be one or the other
Returns
An Axislist with the Axis this constraint Angularly supports.

Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.

virtual AxisList Mezzanine::Physics::Constraint::ValidAxis ( ) const
inlinevirtual

Get a sorted (low to high) list of All Valid Axis.

This is implemented using ValidLinearAxis and ValidAngularAxis, Derived versions of this class may wish to make a more specialized implementation of this method that doesn't have the overhead of passing around 3 vectors by value.

Returns
An Axislist with all the Axis this constraint supports.

Definition at line 186 of file constraint.h.

virtual AxisList Mezzanine::Physics::Constraint::ValidLinearAxis ( ) const
pure virtual

Get a sorted (low to high) list of all axis that operate linearly (that lock sliding/translation)

Warning
Odd behaviors, maybe even undefined behavior can happen if This returns a matching Axis to a Linear Axis. Any given axis should only be one or the other
Returns
An Axislist with the Axis this constraint linearly supports.

Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.

virtual ParamList Mezzanine::Physics::Constraint::ValidParamOnAxis ( int  Axis) const
pure virtual

Get a sorted (low to high) list of Parameters that are valid on this Axis.

Parameters returned from this will work on the given axis even if they are not valid on any other axis. There is no guarantee that the Parameters will be uniquely stored per an axis. There is no guarantee that changing one parameter will not change another.

Parameters
Axisthe Axis to check.
Returns
A Paramlist with all the valid parameters for this axis.

Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.

virtual ParamList Mezzanine::Physics::Constraint::ValidParams ( ) const
inlinevirtual

Get A sorted (low to high) list of Parameters that are valid on all Axis.

This is implemented using ValidAxis and ValidParamOnAxis, Derived versions of this class may wish to make a more specialized implementation of this method that doesn't have the overhead of passing around many vectors by value and executing slow loops. Most likely all of these constraint Parameter and axis functions could be replaced with some fairly simple switch statements and statically coded values that are specific to the kind of constraint.

Returns
A Paramlist with the parameters valid on all axis.

Definition at line 221 of file constraint.h.

Member Data Documentation

RigidProxy* Mezzanine::Physics::Constraint::ProxA
protected

The first Collidable this constraint applies to.

Definition at line 124 of file constraint.h.

RigidProxy* Mezzanine::Physics::Constraint::ProxB
protected

The second Collidable this constraint applies to.

Definition at line 127 of file constraint.h.


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