Newton Dynamics  4.00
ndJointSlider.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_SLIDER_H__
13 #define __ND_JOINT_SLIDER_H__
14 
15 #include "ndNewtonStdafx.h"
16 #include "ndJointBilateralConstraint.h"
17 
19 {
20  public:
21  D_CLASS_REFLECTION(ndJointSlider);
22  D_NEWTON_API ndJointSlider(const ndLoadSaveBase::ndLoadDescriptor& desc);
23  D_NEWTON_API ndJointSlider(const ndMatrix& pinAndPivotFrame, ndBodyKinematic* const child, ndBodyKinematic* const parent);
24  D_NEWTON_API ndJointSlider(const ndMatrix& pinAndPivotInChild, const ndMatrix& pinAndPivotInParent, ndBodyKinematic* const child, ndBodyKinematic* const parent);
25  D_NEWTON_API virtual ~ndJointSlider();
26 
27  D_NEWTON_API ndFloat32 GetSpeed() const;
28  D_NEWTON_API ndFloat32 GetPosit() const;
29  D_NEWTON_API ndFloat32 GetOffsetPosit() const;
30  D_NEWTON_API void SetOffsetPosit(ndFloat32 offset);
31  D_NEWTON_API bool GetLimitState() const;
32  D_NEWTON_API void SetLimitState(bool state);
33  D_NEWTON_API void SetLimits(ndFloat32 minLimit, ndFloat32 maxLimit);
34  D_NEWTON_API void GetLimits(ndFloat32& minLimit, ndFloat32& maxLimit) const;
35  D_NEWTON_API virtual void SetAsSpringDamper(ndFloat32 regularizer, ndFloat32 spring, ndFloat32 damper);
36  D_NEWTON_API void GetSpringDamper(ndFloat32& regularizer, ndFloat32& spring, ndFloat32& damper) const;
37 
38  protected:
39  D_NEWTON_API ndFloat32 PenetrationSpeed(ndFloat32 penetration) const;
40  D_NEWTON_API void SubmitLimits(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
41  D_NEWTON_API void SubmitSpringDamper(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
42 
43  D_NEWTON_API void ApplyBaseRows(ndConstraintDescritor& desc, const ndMatrix& matrix0, const ndMatrix& matrix1);
44  D_NEWTON_API void JacobianDerivative(ndConstraintDescritor& desc);
45  D_NEWTON_API void Save(const ndLoadSaveBase::ndSaveDescriptor& desc) const;
46 
47  ndFloat32 m_posit;
48  ndFloat32 m_speed;
49  ndFloat32 m_springK;
50  ndFloat32 m_damperC;
51  ndFloat32 m_minLimit;
52  ndFloat32 m_maxLimit;
53  ndFloat32 m_positOffset;
54  ndFloat32 m_springDamperRegularizer;
55  ndInt8 m_limitState;
56 };
57 
58 #endif
59 
ndJointSlider
Definition: ndJointSlider.h:19
ndConstraintDescritor
Definition: ndConstraint.h:179
ndJointBilateralConstraint
Definition: ndJointBilateralConstraint.h:53
ndBodyKinematic
Definition: ndBodyKinematic.h:40
ndMatrix
Definition: ndMatrix.h:42
ndLoadSaveBase::ndLoadDescriptor
Definition: ndSaveLoadSytem.h:59
ndLoadSaveBase::ndSaveDescriptor
Definition: ndSaveLoadSytem.h:93