ScummVM API documentation
dgBallConstraint.h
1 /* Copyright (c) <2003-2011> <Julio Jerez, 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, subject to the following restrictions:
10  *
11  * 1. The origin of this software must not be misrepresented; you must not
12  * claim that you wrote the original software. If you use this software
13  * in a product, an acknowledgment in the product documentation would be
14  * appreciated but is not required.
15  *
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  * misrepresented as being the original software.
18  *
19  * 3. This notice may not be removed or altered from any source distribution.
20  */
21 
22 #ifndef AFX_DGBALLCONSTRAINT_H__7C9E1F9A_5EC6_48BE_8C9F_FB90132C6619__INCLUDED_
23 #define AFX_DGBALLCONSTRAINT_H__7C9E1F9A_5EC6_48BE_8C9F_FB90132C6619__INCLUDED_
24 #include "dgBilateralConstraint.h"
25 
26 
27 // template<class T> class dgPool;
28 
29 class dgBallConstraint;
30 typedef void(dgApi *dgBallJointFriction)(const NewtonJoint *const ball, dFloat timestep);
31 
33 public:
34  dgVector GetJointAngle() const;
35  dgVector GetJointOmega() const;
36  dgVector GetJointForce() const;
37  void SetJointParameterCallBack(dgBallJointFriction callback);
38 
39  bool GetTwistLimitState() const;
40  void SetTwistLimitState(bool state);
41 
42  bool GetConeLimitState() const;
43  void SetConeLimitState(bool state);
44 
45  bool GetLatealLimitState() const;
46  void SetLatealLimitState(bool state);
47 
48  void SetLimits(const dgVector &coneDir, dgFloat32 minConeAngle, dgFloat32 maxConeAngle, dgFloat32 maxTwistAngle,
49  const dgVector &bilateralDir, dgFloat32 negativeBilateralConeAngle, dgFloat32 positiveBilateralConeAngle);
50 
51 private:
53  virtual ~dgBallConstraint();
54  // virtual void Remove (dgWorld* world);
55 
56  void SetPivotPoint(const dgVector &pivot);
57  virtual dgUnsigned32 JacobianDerivative(dgContraintDescritor &params);
58  // static dgBallConstraint* Create(dgWorld* world);
59 
60  dgVector m_angles;
61  union limits {
62  unsigned m_ballLimits;
63  struct s {
64  dgUnsigned32 m_coneLimit : 1;
65  dgUnsigned32 m_twistLimit : 1;
66  dgUnsigned32 m_lateralLimit : 1;
67  } s;
68  } limits;
69  dgFloat32 m_coneAngle;
70  dgFloat32 m_twistAngle;
71  dgFloat32 m_coneAngleCos;
72  dgBallJointFriction m_jointUserCallback;
73 
74  // dgUnsigned32 m_reserve[3];
75 
76  friend class dgWorld;
77  // friend class dgPool<dgBallConstraint>;
78 };
79 
80 // class dgBallConstraintArray: public dgPoolContainer<dgBallConstraint>
81 //{
82 // };
83 
84 #endif
Definition: dgVector.h:86
Definition: dgBallConstraint.h:32
Definition: dgConstraint.h:137
Definition: dgBilateralConstraint.h:28
Definition: dgBallConstraint.h:63
Definition: dgWorld.h:118