25 #pragma warning( push )
26 #pragma warning( disable : 4589 )
45 class ConstraintImplementation;
46 class DebugRendererCache;
49 class RigidBodyAttachment;
51 class RegularizationParameters;
96 DIRECT_AND_ITERATIVE = (DIRECT | ITERATIVE)
586 template<
typename T >
598 template<
typename T >
602 template<
typename T >
606 template<
typename T >
658 agx::
Bool m_debugRenderingEnable;
859 virtual ~ConstraintFrame();
861 Vec3& operator [] (
const unsigned int& i );
862 const Vec3& operator [] (
const unsigned int& i )
const;
864 void setTranslate(
const Vec3& translate );
865 const Vec3& getTranslate()
const;
874 return m_implementation;
879 return m_implementation;
882 template<
typename T >
892 template<
typename T >
903 template<
typename T >
906 return dynamic_cast<T*
>(
this);
910 template<
typename T >
913 return dynamic_cast<const T*
>(
this);
918 #if defined(_MSC_VER)
919 #pragma warning( pop )
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Class for writing serialized data in binary format to a stream.
Abstract base class for storing/restoring a line/drums with version control.
Constraint attachment pair class.
Constraint attachment base class for any type of frame.
Specialization for constraints that have only one degree of freedom such as Hinge and Prismatic.
const agx::ElectricMotorController * getElectricMotorController() const
const agx::Motor1D * getMotor1D() const
agx::ElectricMotorController * getElectricMotorController()
agx::Real getAngle() const
This method return the current angle for the 1D constraint.
agx::Motor1D * getMotor1D()
const agx::FrictionController * getFrictionController() const
virtual ~Constraint1DOF()
agx::Lock1D * getLock1D()
agx::FrictionController * getFrictionController()
agx::Real getCurrentSpeed() const
This methods return the current speed for the 1D constraint.
const agx::Range1D * getRange1D() const
agx::Range1D * getRange1D()
const agx::Lock1D * getLock1D() const
static agx::Constraint1DOF * safeCast(const agx::Constraint *constraint)
Utility method for not so type safe languages.
Specialization for constraints that have only one degree of freedom such as Hinge and Prismatic.
agx::Real getCurrentSpeed(agx::Constraint2DOF::DOF dof) const
const agx::ElectricMotorController * getElectricMotorController(agx::Constraint2DOF::DOF dof) const
DOF
Specifies a selected degree of freedom.
const agx::FrictionController * getFrictionController(agx::Constraint2DOF::DOF dof) const
agx::ElectricMotorController * getElectricMotorController(agx::Constraint2DOF::DOF dof)
const agx::Motor1D * getMotor1D(agx::Constraint2DOF::DOF dof) const
const agx::Range1D * getRange1D(agx::Constraint2DOF::DOF dof) const
const agx::Lock1D * getLock1D(agx::Constraint2DOF::DOF dof) const
static agx::Constraint2DOF * safeCast(const agx::Constraint *constraint)
Utility method for not so type safe languages.
agx::Range1D * getRange1D(agx::Constraint2DOF::DOF dof)
agx::Screw1D * getScrew1D()
Screw controller connects rotation and translation.
agx::Real getAngle(agx::Constraint2DOF::DOF dof) const
const agx::Screw1D * getScrew1D() const
Screw controller connects rotation and translation.
virtual ~Constraint2DOF()
agx::Lock1D * getLock1D(agx::Constraint2DOF::DOF dof)
agx::FrictionController * getFrictionController(agx::Constraint2DOF::DOF dof)
agx::Motor1D * getMotor1D(agx::Constraint2DOF::DOF dof)
The base class for a constraint.
agx::RigidBodyAttachment * getAttachment(const agx::RigidBody *rb) const
void setRep(agx::ConstraintImplementation *_rep)
agx::AttachmentPair * getAttachmentPair() const
void restore(agxStream::InputArchive &in) override
agx::Bool removeElementaryConstraint(agx::ElementaryConstraint *elementaryConstraint)
Remove elementary constraint.
agx::UInt getNumElementaryConstraints() const
agx::ElementaryConstraint * getElementaryConstraint(const agx::UInt index) const
virtual Real getDamping(agx::UInt dof) const
Get the damping for DOF dof.
const agx::RigidBody * getBodyAt(agx::UInt i) const
agx::Bool getLastForce(agx::UInt bodyIndex, agx::Vec3 &retForce, agx::Vec3 &retTorque, agx::Bool giveForceAtCm=false) const
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the b...
virtual void setElasticity(agx::Real elasticity, agx::Int dof)
Set the elasticity of this constraint for the i:th DOF.
bool getEnableLinearization() const
agx::Constraint::SolveType getSolveType() const
void setForceRange(agx::RangeReal forceRange, agx::Int dof)
Assign force range, of an elementary constraint, for a given DOF.
agx::RigidBody * getBodyAt(agx::UInt i)
agx::UInt calculateNumActiveRows() const
Calculates the current number of active rows, including both elementary and secondary constraints.
agx::Bool getLastLocalForce(agx::UInt bodyIndex, agx::Vec3 &retForce, agx::Vec3 &retTorque, agx::Bool giveForceAtCm=false) const
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the b...
virtual void postSystemCallback(agx::DynamicsSystem *dynamicsSystem) override
Called after all post step events, after solve.
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agx::Constraint)
agx::ConstraintImplementation * m_implementation
agx::Bool removeSecondaryConstraint(agx::ElementaryConstraint *secondaryConstraint)
Remove secondary constraint.
static agx::ref_ptr< T > createFromWorld(agx::Vec3 worldPoint, agx::Vec3 worldAxis, agx::RigidBody *rb1, agx::RigidBody *rb2=nullptr)
Creates a constraint given a point and an axis in world frame.
agx::Bool isEnabled() const
void setDamping(agx::Real damping)
Set the damping of this constraint for all DOFs.
agx::Bool addSecondaryConstraint(const agx::Name &name, agx::ElementaryConstraint *secondaryConstraint)
Add secondary constraint (like motor, range and/or lock etc) given name.
static agx::ref_ptr< T > createFromBody(agx::Vec3 bodyPoint, agx::Vec3 bodyAxis, agx::RigidBody *rb1, agx::RigidBody *rb2=nullptr)
Creates a constraint given a point and an axis in rb1 model frame.
agx::Bool getEnableComputeForces() const
agx::ElementaryConstraint * getSecondaryConstraintGivenName(const agx::Name &name) const
Find secondary constraint given name.
virtual void setEnable(agx::Bool enable)
Enable/disable a constraint.
agx::Bool getLastForce(const agx::RigidBody *rb, agx::Vec3 &retForce, agx::Vec3 &retTorque, agx::Bool giveForceAtCm=false) const
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the b...
virtual void render(class agxRender::RenderManager *mgr, float scale) const =0
Inherited method of how to render this constraint into DebugRenderer.
void store(agxStream::OutputArchive &out) const override
agx::Bool getLastLocalForce(const agx::RigidBody *rb, agx::Vec3 &retForce, agx::Vec3 &retTorque, agx::Bool giveForceAtCm=false) const
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the b...
virtual void storeLightData(agxStream::StorageStream &str) const override
agx::UInt32 getEntityId() const
agx::Attachment * getAttachment(agx::UInt i) const
static agx::Bool calculateFramesFromBody(agx::Vec3 bodyPoint, agx::Vec3 bodyAxis, const agx::RigidBody *body, agx::Frame *bodyFrame, const agx::RigidBody *otherBody, agx::Frame *otherFrame)
Calculates the constraint attachment frames given point and axis in body coordinates of body.
virtual void removeNotification() override
Called when removed from a simulation.
static agx::Bool calculateFramesFromBody(agx::Vec3 bodyPoint, agx::Vec3 bodyAxis, agx::Vec3 secondBodyAxis, const agx::RigidBody *body, agx::Frame *bodyFrame, const agx::RigidBody *otherBody, agx::Frame *otherFrame)
Calculates the constraint attachment frames given point and axes in body coordinates of body.
void setForceRange(agx::Real lower, agx::Real upper, agx::Int dof)
Assign force range, of an elementary constraint, for a given DOF.
agx::ElementaryConstraint * getElementaryConstraintGivenName(const agx::Name &name) const
Find elementary constraint given name.
agx::Bool removeSecondaryConstraint(const agx::Name &name)
Remove secondary constraint.
static agx::Bool calculateFramesFromWorld(agx::Vec3 worldPoint, agx::Vec3 worldAxis, const agx::RigidBody *rb1, agx::Frame *rb1Frame, const agx::RigidBody *rb2, agx::Frame *rb2Frame)
Given a point and an axis in world, this function calculates each local attachment frame for one or t...
void setEnableComputeForces(agx::Bool enable)
Enable (or disable) computation of the forces applied to the dynamic bodies in this constraint.
void setForceRange(agx::RangeReal forceRange)
Assign force range for all DOF of the elementary constraints.
virtual agx::RegularizationParameters * getRegularizationParameters(agx::UInt i)
agx::UInt getNumSecondaryConstraints() const
void setCompliance(agx::Real compliance)
Set the compliance of this constraint for all DOFs.
agx::ConstraintImplementation * getRep()
virtual agx::Bool rebind()
Rebind this constraint, i.e., use current state as the initial configuration.
bool getEnableDebugRendering() const
T * as()
Try to do dynamic_cast on the constraint and return a pointer to the casted constraint.
void setEnableDebugRendering(agx::Bool enable)
Enable/disable debug rendering of this constraint.
virtual void setCompliance(agx::Real compliance, agx::Int dof)
Set the compliance of this constraint for the i:th DOF.
agx::ElementaryConstraint * getSecondaryConstraint(const agx::UInt index) const
virtual void setElasticity(agx::Real elasticity)
Set the elasticity of this constraint for all DOFs.
virtual void addNotification() override
Called when added to a simulation.
virtual int getNumDOF() const =0
virtual agx::Real getCompliance(agx::UInt dof) const
Get the compliance for DOF i.
agx::Bool getEnable() const
virtual void setDamping(agx::Real damping, agx::Int dof)
Set the damping of this constraint for the i:th DOF.
virtual void restoreLightData(agxStream::StorageStream &str) override
virtual void setSystem(agx::DynamicsSystem *)
agx::Bool removeElementaryConstraint(const agx::Name &name)
Remove elementary constraint.
agx::Bool addElementaryConstraint(const agx::Name &name, agx::ElementaryConstraint *elementaryConstraint)
Add elementary constraint (like Spherical, Dot1, Dot2 etc) given name.
static agx::Bool calculateFramesFromWorld(agx::Vec3 worldPoint, agx::Vec3 worldAxis, agx::Vec3 secondWorldAxis, const agx::RigidBody *rb1, agx::Frame *rb1Frame, const agx::RigidBody *rb2, agx::Frame *rb2Frame)
Given a point and two axes in world, this function calculates each local attachment frame for one or ...
agx::RangeReal getForceRange(agx::UInt dof=0) const
Get the force range for DOF dof.
agx::Bool getValid() const
virtual void preSystemCallback(agx::DynamicsSystem *dynamicsSystem) override
Called after all pre step events, before solve.
void setEnableLinearization(bool enable)
Pass true to enable linearization of constraint compliance.
virtual const agx::RegularizationParameters * getRegularizationParameters(agx::UInt i) const
SolveType
Specifies in what solvers the constraint will be solved.
void setSolveType(agx::Constraint::SolveType solveType)
Specify the solve type for this constraint.
agx::UInt getNumBodies() const
returns the number of bodies involved
virtual agx::Real getElasticity(agx::UInt dof) const
Get the elasticity for DOF i.
virtual void setSimulation(agxSDK::Simulation *simulation) override
Assign simulation.
agx::Real getCurrentForce(agx::UInt dof) const
Consider using getLastForce instead.
The complete physical system with bodies, interactions, data layout, time stepper,...
Implementation of a electric motor controller.
Elementary constraint base class with interface and global constraint functionality.
The object defining a frame of reference and providing transformations operations.
Translational or rotational friction controller for Hinge, Prismatic and CylindricalJoint.
The base class for interactions.
Internal data for any object, ObjT, with methods: agx::Referenced* ObjT::getInternalData() const; voi...
Elementary secondary constraint to keep constraint angle at a given target position.
Representation of a name string.
Elementary secondary constraint to keep constraint angle within two given values.
Base class providing referencing counted objects.
All ghost variables have compliance and damping attributes.
Constraint attachment class for agx::RigidBody.
The rigid body class, combining a geometric model and a frame of reference.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Elementary secondary constraint to drive something given target speed (translational or rotational).
Smart pointer for handling referenced counted objects.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
Namespace containing classes for handling debug rendering of collision geometries,...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::SetVector< ref_ptr< Constraint > > ConstraintRefSetVector