Blender  V3.3
btPoint2PointConstraint.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 
16 #ifndef BT_POINT2POINTCONSTRAINT_H
17 #define BT_POINT2POINTCONSTRAINT_H
18 
19 #include "LinearMath/btVector3.h"
20 #include "btJacobianEntry.h"
21 #include "btTypedConstraint.h"
22 
23 class btRigidBody;
24 
25 #ifdef BT_USE_DOUBLE_PRECISION
26 #define btPoint2PointConstraintData2 btPoint2PointConstraintDoubleData2
27 #define btPoint2PointConstraintDataName "btPoint2PointConstraintDoubleData2"
28 #else
29 #define btPoint2PointConstraintData2 btPoint2PointConstraintFloatData
30 #define btPoint2PointConstraintDataName "btPoint2PointConstraintFloatData"
31 #endif //BT_USE_DOUBLE_PRECISION
32 
34 {
36  m_damping(btScalar(1.)),
38  {
39  }
43 };
44 
46 {
49 };
50 
54 {
55 #ifdef IN_PARALLELL_SOLVER
56 public:
57 #endif
58  btJacobianEntry m_jac[3]; //3 orthogonal linear constraints
59 
62 
63  int m_flags;
66 
67 public:
69 
72 
74 
75  btPoint2PointConstraint(btRigidBody & rbA, btRigidBody & rbB, const btVector3& pivotInA, const btVector3& pivotInB);
76 
77  btPoint2PointConstraint(btRigidBody & rbA, const btVector3& pivotInA);
78 
79  virtual void buildJacobian();
80 
81  virtual void getInfo1(btConstraintInfo1 * info);
82 
84 
85  virtual void getInfo2(btConstraintInfo2 * info);
86 
87  void getInfo2NonVirtual(btConstraintInfo2 * info, const btTransform& body0_trans, const btTransform& body1_trans);
88 
89  void updateRHS(btScalar timeStep);
90 
91  void setPivotA(const btVector3& pivotA)
92  {
93  m_pivotInA = pivotA;
94  }
95 
96  void setPivotB(const btVector3& pivotB)
97  {
98  m_pivotInB = pivotB;
99  }
100 
101  const btVector3& getPivotInA() const
102  {
103  return m_pivotInA;
104  }
105 
106  const btVector3& getPivotInB() const
107  {
108  return m_pivotInB;
109  }
110 
113  virtual void setParam(int num, btScalar value, int axis = -1);
115  virtual btScalar getParam(int num, int axis = -1) const;
116 
117  virtual int getFlags() const
118  {
119  return m_flags;
120  }
121 
122  virtual int calculateSerializeBufferSize() const;
123 
125  virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
126 };
127 
130 {
134 };
135 
138 {
142 };
143 
144 #ifdef BT_BACKWARDS_COMPATIBLE_SERIALIZATION
149 {
153 };
154 #endif //BT_BACKWARDS_COMPATIBLE_SERIALIZATION
155 
157 {
158  return sizeof(btPoint2PointConstraintData2);
159 }
160 
162 SIMD_FORCE_INLINE const char* btPoint2PointConstraint::serialize(void* dataBuffer, btSerializer* serializer) const
163 {
165 
166  btTypedConstraint::serialize(&p2pData->m_typeConstraintData, serializer);
167  m_pivotInA.serialize(p2pData->m_pivotInA);
168  m_pivotInB.serialize(p2pData->m_pivotInB);
169 
171 }
172 
173 #endif //BT_POINT2POINTCONSTRAINT_H
btFixedConstraint btRigidBody & rbB
btJacobianEntry
#define btPoint2PointConstraintData2
btPoint2PointConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &pivotInA, const btVector3 &pivotInB)
BT_DECLARE_ALIGNED_ALLOCATOR()
virtual void getInfo2(btConstraintInfo2 *info)
btVector3 m_pivotInA
const btVector3 & getPivotInA() const
virtual void setParam(int num, btScalar value, int axis=-1)
void setPivotA(const btVector3 &pivotA)
virtual int calculateSerializeBufferSize() const
void setPivotB(const btVector3 &pivotB)
@ BT_P2P_FLAGS_CFM
@ BT_P2P_FLAGS_ERP
void getInfo2NonVirtual(btConstraintInfo2 *info, const btTransform &body0_trans, const btTransform &body1_trans)
bool m_useSolveConstraintObsolete
for backwards compatibility during the transition to 'getInfo/getInfo2'
virtual int getFlags() const
virtual btScalar getParam(int num, int axis=-1) const
return the local value of parameter
btVector3 m_pivotInB
virtual void buildJacobian()
obsolete methods
#define btPoint2PointConstraintDataName
void getInfo1NonVirtual(btConstraintInfo1 *info)
virtual void getInfo1(btConstraintInfo1 *info)
btScalar m_erp
const btVector3 & getPivotInB() const
btScalar m_cfm
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
btConstraintSetting m_setting
void updateRHS(btScalar timeStep)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:285
#define SIMD_FORCE_INLINE
Definition: btScalar.h:280
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:30
btTypedConstraint(btTypedConstraintType type, btRigidBody &rbA)
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:82
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btTypedConstraintDoubleData m_typeConstraintData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
this structure is not used, except for loading pre-2.82 .bullet files