6 #include "BlConstraintRelaxation.h"
8 #include "BlMotorizedJoint.h"
9 #include "BlRigidBody.h"
10 #include "BlSimulator.h"
21 BlConstraintRelaxation::BlConstraintRelaxation()
24 m_lpConstraint = NULL;
29 m_bDisallowSpringEnable =
false;
32 BlConstraintRelaxation::~BlConstraintRelaxation()
63 SetRelaxationProperties();
93 SetRelaxationProperties();
125 SetRelaxationProperties();
150 SetRelaxationProperties();
167 return m_bDisallowSpringEnable;
184 m_bDisallowSpringEnable = bVal;
189 ConstraintRelaxation::Initialize();
198 SetRelaxationProperties();
210 ConstraintRelaxation::CreateDefaultUnits();
226 if(ConstraintRelaxation::SetData(strType, strValue,
false))
229 if(strType ==
"MINLIMIT")
231 MinLimit((
float) atof(strValue.c_str()));
235 if(strType ==
"MAXLIMIT")
237 MaxLimit((
float) atof(strValue.c_str()));
241 if(strType ==
"EQPOS")
243 EqPos((
float) atof(strValue.c_str()));
249 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
254 void BlConstraintRelaxation::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
256 ConstraintRelaxation::QueryProperties(aryProperties);
258 aryProperties.Add(
new TypeProperty(
"MinLimit", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
259 aryProperties.Add(
new TypeProperty(
"MaxLimit", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
260 aryProperties.Add(
new TypeProperty(
"EqPos", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
263 void BlConstraintRelaxation::Load(CStdXml &oXml)
265 ConstraintRelaxation::Load(oXml);
277 void BlConstraintRelaxation::SetRelaxationProperties()
281 if(m_bDisallowSpringEnable)
282 m_lpBlJoint->AxisConstraintSpringEnableChanged(
m_bEnabled);
290 m_lpBlJoint->SetLimitValues();
A common class for all joint data specific to vortex.
Simulator * m_lpSim
The pointer to a Simulation.
int m_iCoordinateID
The constraint coordinate ID.
virtual void Initialize()
Initializes this object.
virtual float EqPos()
Gets the equilibrium position for the spring that controls this relaxation.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
virtual float MinLimit()
Gets the minimum value that this relaxation can move.
float m_fltDamping
The damping of the collision between those two materials.
float m_fltStiffness
The compliance of the collision between those two materials.
virtual float DisplayMassUnits()
Gets the density mass units.
Node * m_lpNode
The pointer to this items parent Node. If this is not relevant for this object then this is NULL...
virtual float Damping()
Gets the damping for collisions between RigidBodies with these two materials.
virtual void CreateDefaultUnits()
This takes the default values defined in the constructor and scales them according to the distance an...
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
float m_fltMinLimit
The minimum amount that this relaxation is allowed to move.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual bool DisallowSpringEnable()
Gets the disallow spring enable.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
float m_fltMaxLimit
The maximum amount that this relaxation is allowed to move.
virtual float InverseDistanceUnits()
Gets the inverse distance units.
virtual float MaxLimit()
Gets the maximum value that this relaxation can move.
float m_fltEqPos
The equilibrium position of the spring that controls this relaxation.