Newton Dynamics  4.00
ndIkSwivelPositionEffector.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_IK_SWIVEL_POSITION_EFFECTOR_H__
13 #define __ND_IK_SWIVEL_POSITION_EFFECTOR_H__
14 
15 #include "ndNewtonStdafx.h"
16 #include "ndJointBilateralConstraint.h"
17 
19 {
20  public:
21  enum ndRotationOrder
22  {
23  m_pitchRollYaw,
24  m_pitchYawRoll,
25  };
26 
27  D_CLASS_REFLECTION(ndIkSwivelPositionEffector);
29  D_NEWTON_API ndIkSwivelPositionEffector(const ndVector& childPivot, const ndMatrix& pinAndPivotParent, ndBodyKinematic* const child, ndBodyKinematic* const parent);
30  D_NEWTON_API virtual ~ndIkSwivelPositionEffector();
31 
32  D_NEWTON_API ndVector GetLocalTargetPosition() const;
33  D_NEWTON_API void SetLocalTargetPosition(const ndVector& posit);
34 
35  D_NEWTON_API ndVector GetGlobalPosition() const;
36 
37  D_NEWTON_API ndFloat32 GetSwivelAngle() const;
38  D_NEWTON_API void SetSwivelAngle(const ndFloat32 angle);
39 
40  D_NEWTON_API void SetLinearSpringDamper(ndFloat32 regularizer, ndFloat32 springConst, ndFloat32 damperConst);
41  D_NEWTON_API void GetLinearSpringDamper(ndFloat32& regularizer, ndFloat32& springConst, ndFloat32& damperConst) const;
42 
43  D_NEWTON_API void SetAngularSpringDamper(ndFloat32 regularizer, ndFloat32 springConst, ndFloat32 damperConst);
44  D_NEWTON_API void GetAngularSpringDamper(ndFloat32& regularizer, ndFloat32& springConst, ndFloat32& damperConst) const;
45 
46  D_NEWTON_API void SetWorkSpaceConstraints(ndFloat32 minRadio, ndFloat32 maxRadio);
47  D_NEWTON_API void GetWorkSpaceConstraints(ndFloat32& minRadio, ndFloat32& maxRadio) const;
48 
49  D_NEWTON_API ndFloat32 GetMaxForce() const;
50  D_NEWTON_API void SetMaxForce(ndFloat32 force);
51 
52  D_NEWTON_API bool GetSwivelMode() const;
53  D_NEWTON_API void SetSwivelMode(bool active);
54 
55  D_NEWTON_API ndFloat32 GetMaxTorque() const;
56  D_NEWTON_API void SetMaxTorque(ndFloat32 torque);
57 
58  protected:
59  D_NEWTON_API void JacobianDerivative(ndConstraintDescritor& desc);
60  D_NEWTON_API void Save(const ndLoadSaveBase::ndSaveDescriptor& desc) const;
61  D_NEWTON_API void DebugJoint(ndConstraintDebugCallback& debugCallback) const;
62 
63  ndMatrix CalculateSwivelFrame(const ndMatrix& matrix1) const;
64  void SubmitLinearAxis(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
65  void SubmitAngularAxis(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
66 
67  ndVector m_localTargetPosit;
68  ndFloat32 m_swivelAngle;
69 
70  ndFloat32 m_angularSpring;
71  ndFloat32 m_angularDamper;
72  ndFloat32 m_angularMaxTorque;
73  ndFloat32 m_angularRegularizer;
74 
75  ndFloat32 m_linearSpring;
76  ndFloat32 m_linearDamper;
77  ndFloat32 m_linearMaxForce;
78  ndFloat32 m_linearRegularizer;
79 
80  ndFloat32 m_minWorkSpaceRadio;
81  ndFloat32 m_maxWorkSpaceRadio;
82  ndRotationOrder m_rotationOrder;
83  bool m_enableSwivelControl;
84 };
85 
86 #endif
87 
ndConstraintDescritor
Definition: ndConstraint.h:179
ndJointBilateralConstraint
Definition: ndJointBilateralConstraint.h:53
ndIkSwivelPositionEffector
Definition: ndIkSwivelPositionEffector.h:19
ndConstraintDebugCallback
Definition: ndConstraint.h:42
ndBodyKinematic
Definition: ndBodyKinematic.h:40
ndMatrix
Definition: ndMatrix.h:42
ndLoadSaveBase::ndLoadDescriptor
Definition: ndSaveLoadSytem.h:59
ndLoadSaveBase::ndSaveDescriptor
Definition: ndSaveLoadSytem.h:93
ndVector
Definition: ndVectorArmNeon.h:41