Newton Dynamics  4.00
ndJointRoller.h
1 /* Copyright (c) <2003-2022> <Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely
10 */
11 
12 #ifndef __ND_JOINT_ROLLER_H__
13 #define __ND_JOINT_ROLLER_H__
14 
15 #include "ndNewtonStdafx.h"
16 #include "ndJointBilateralConstraint.h"
17 
19 {
20  public:
21  D_CLASS_REFLECTION(ndJointRoller);
22  D_NEWTON_API ndJointRoller(const ndLoadSaveBase::ndLoadDescriptor& desc);
23  D_NEWTON_API ndJointRoller(const ndMatrix& pinAndPivotFrame, ndBodyKinematic* const child, ndBodyKinematic* const parent);
24  D_NEWTON_API ndJointRoller(const ndMatrix& pinAndPivotInChild, const ndMatrix& pinAndPivotInParent, ndBodyKinematic* const child, ndBodyKinematic* const parent);
25  D_NEWTON_API virtual ~ndJointRoller();
26 
27  D_NEWTON_API ndFloat32 GetAngle() const;
28  D_NEWTON_API ndFloat32 GetOmega() const;
29  D_NEWTON_API ndFloat32 GetOffsetAngle() const;
30  D_NEWTON_API void SetOffsetAngle(ndFloat32 angle);
31  D_NEWTON_API bool GetLimitStateAngle() const;
32  D_NEWTON_API void SetLimitStateAngle(bool state);
33  D_NEWTON_API void SetLimitsAngle(ndFloat32 minLimit, ndFloat32 maxLimit);
34  D_NEWTON_API void GetLimitsAngle(ndFloat32& minLimit, ndFloat32& maxLimit) const;
35  D_NEWTON_API void SetAsSpringDamperAngle(ndFloat32 regularizer, ndFloat32 spring, ndFloat32 damper);
36  D_NEWTON_API void GetSpringDamperAngle(ndFloat32& regularizer, ndFloat32& spring, ndFloat32& damper) const;
37 
38  D_NEWTON_API ndFloat32 GetPosit() const;
39  D_NEWTON_API ndFloat32 GetOffsetPosit() const;
40  D_NEWTON_API void SetOffsetPosit(ndFloat32 offset);
41  D_NEWTON_API bool GetLimitStatePosit() const;
42  D_NEWTON_API void SetLimitStatePosit(bool state);
43  D_NEWTON_API void SetLimitsPosit(ndFloat32 minLimit, ndFloat32 maxLimit);
44  D_NEWTON_API void GetLimitsPosit(ndFloat32& minLimit, ndFloat32& maxLimit) const;
45  D_NEWTON_API void SetAsSpringDamperPosit(ndFloat32 regularizer, ndFloat32 spring, ndFloat32 damper);
46  D_NEWTON_API void GetSpringDamperPosit(ndFloat32& regularizer, ndFloat32& spring, ndFloat32& damper) const;
47 
48  protected:
49  D_NEWTON_API ndFloat32 PenetrationOmega(ndFloat32 penetartion) const;
50  D_NEWTON_API void SubmitLimitsAngle(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
51  D_NEWTON_API void SubmitSpringDamperAngle(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
52 
53  D_NEWTON_API ndFloat32 PenetrationSpeed(ndFloat32 penetration) const;
54  D_NEWTON_API void SubmitLimitsPosit(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
55  D_NEWTON_API void SubmitSpringDamperPosit(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
56 
57  D_NEWTON_API void JacobianDerivative(ndConstraintDescritor& desc);
58  D_NEWTON_API void Save(const ndLoadSaveBase::ndSaveDescriptor& desc) const;
59  D_NEWTON_API void DebugJoint(ndConstraintDebugCallback& debugCallback) const;
60  D_NEWTON_API void ApplyBaseRows(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
61 
62  ndFloat32 m_angle;
63  ndFloat32 m_omega;
64  ndFloat32 m_springKAngle;
65  ndFloat32 m_damperCAngle;
66  ndFloat32 m_minLimitAngle;
67  ndFloat32 m_maxLimitAngle;
68  ndFloat32 m_offsetAngle;
69  ndFloat32 m_springDamperRegularizerAngle;
70 
71  ndFloat32 m_posit;
72  ndFloat32 m_speed;
73  ndFloat32 m_springKPosit;
74  ndFloat32 m_damperCPosit;
75  ndFloat32 m_minLimitPosit;
76  ndFloat32 m_maxLimitPosit;
77  ndFloat32 m_offsetPosit;
78  ndFloat32 m_springDamperRegularizerPosit;
79 
80  ndInt8 m_limitStatePosit;
81  ndInt8 m_limitStateAngle;
82 };
83 
84 #endif
85 
ndConstraintDescritor
Definition: ndConstraint.h:179
ndJointBilateralConstraint
Definition: ndJointBilateralConstraint.h:53
ndConstraintDebugCallback
Definition: ndConstraint.h:42
ndBodyKinematic
Definition: ndBodyKinematic.h:40
ndMatrix
Definition: ndMatrix.h:42
ndJointRoller
Definition: ndJointRoller.h:19
ndLoadSaveBase::ndLoadDescriptor
Definition: ndSaveLoadSytem.h:59
ndLoadSaveBase::ndSaveDescriptor
Definition: ndSaveLoadSytem.h:93