My Project: dynamics.mod/NewtonDynamics/source/physics/dgBallConstraint.h Source File

My Project

dgBallConstraint.h
Go to the documentation of this file.
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 #if !defined(AFX_DGBALLCONSTRAINT_H__7C9E1F9A_5EC6_48BE_8C9F_FB90132C6619_H)
23 #define AFX_DGBALLCONSTRAINT_H__7C9E1F9A_5EC6_48BE_8C9F_FB90132C6619_H
24 #include "dgBilateralConstraint.h"
25
26 #ifdef _WIN_32_VER
27 #pragma warning (disable: 4201) //nonstandard extension used : nameless struct/union
28 #endif
29
30
31 //template<class T> class dgPool;
32
33 class dgBallConstraint;
34 typedef dgUnsigned32 (dgApi *dgBallJointFriction) (const dgBallConstraint& ball,dgFloat32 timestep);
35
36 class dgBallConstraint: public dgBilateralConstraint
37 {
38 public:
39 dgVector GetJointAngle ()const;
40 dgVector GetJointOmega ()const;
41 dgVector GetJointForce ()const;
42 void SetJointParameterCallback (dgBallJointFriction callback);
43
44 bool GetTwistLimitState () const;
45 void SetTwistLimitState (bool state);
46
47 bool GetConeLimitState () const;
48 void SetConeLimitState (bool state);
49
50 bool GetLatealLimitState () const;
51 void SetLatealLimitState (bool state);
52
53
54 void SetLimits (const dgVector& coneDir, dgFloat32 minConeAngle, dgFloat32 maxConeAngle, dgFloat32 maxTwistAngle,
55 const dgVector& bilateralDir, dgFloat32 negativeBilateralConeAngle, dgFloat32 positiveBilateralConeAngle);
56
57
58 private:
59 dgBallConstraint ();
60 virtual ~dgBallConstraint ();
61 // virtual void Remove (dgWorld* world);
62
63 void SetPivotPoint (const dgVector& pivot);
64 virtual dgUnsigned32 JacobianDerivative (dgContraintDescritor& params);
65 // static dgBallConstraint* Create(dgWorld* world);
66
67
68 dgVector m_angles;
69 union {
70 unsigned m_ballLimits;
71 struct {
72 dgUnsigned32 m_coneLimit : 1;
73 dgUnsigned32 m_twistLimit : 1;
74 dgUnsigned32 m_lateralLimit : 1;
75 };
76 };
77 dgFloat32 m_coneAngle;
78 dgFloat32 m_twistAngle;
79 dgFloat32 m_coneAngleCos;
80 dgBallJointFriction m_jointUserCallback;
81
82 // dgUnsigned32 m_reserve[3];
83
84 friend class dgWorld;
85 // friend class dgPool<dgBallConstraint>;
86 };
87
88 //class dgBallConstraintArray: public dgPoolContainer<dgBallConstraint>
89 //{
90 //};
91
92
93 #endif
94
dgApi
#define dgApi
Definition: dgTypes.h:263
dgBallConstraint::SetLatealLimitState
void SetLatealLimitState(bool state)
Definition: dgBallConstraint.cpp:151
dgBallConstraint::SetLimits
void SetLimits(const dgVector &coneDir, dgFloat32 minConeAngle, dgFloat32 maxConeAngle, dgFloat32 maxTwistAngle, const dgVector &bilateralDir, dgFloat32 negativeBilateralConeAngle, dgFloat32 positiveBilateralConeAngle)
Definition: dgBallConstraint.cpp:175
dgBallConstraint::m_ballLimits
unsigned m_ballLimits
Definition: dgBallConstraint.h:70
dgBallConstraint::GetConeLimitState
bool GetConeLimitState() const
Definition: dgBallConstraint.cpp:131
dgFloat32
float dgFloat32
Definition: dgTypes.h:233
dgVector
Definition: dgVector.h:639
dgBallConstraint::m_coneLimit
dgUnsigned32 m_coneLimit
Definition: dgBallConstraint.h:72
dgBallConstraint::GetJointAngle
dgVector GetJointAngle() const
Definition: dgBallConstraint.cpp:89
dgBallConstraint
Definition: dgBallConstraint.h:36
dgContraintDescritor
Definition: dgConstraint.h:118
dgBilateralConstraint
Definition: dgBilateralConstraint.h:29
dgBallConstraint::SetJointParameterCallback
void SetJointParameterCallback(dgBallJointFriction callback)
Definition: dgBallConstraint.cpp:83
dgBilateralConstraint.h
dgBallConstraint::SetTwistLimitState
void SetTwistLimitState(bool state)
Definition: dgBallConstraint.cpp:141
dgUnsigned32
unsigned dgUnsigned32
Definition: dgTypes.h:219
dgBallConstraint::GetJointOmega
dgVector GetJointOmega() const
Definition: dgBallConstraint.cpp:94
dgBallConstraint::m_twistLimit
dgUnsigned32 m_twistLimit
Definition: dgBallConstraint.h:73
dgUnsigned32
typedef dgUnsigned32(dgApi *dgBallJointFriction)(const dgBallConstraint &ball
dgBallConstraint::SetConeLimitState
void SetConeLimitState(bool state)
Definition: dgBallConstraint.cpp:146
timestep
dgFloat32 timestep
Definition: dgBallConstraint.h:34
dgBallConstraint::GetLatealLimitState
bool GetLatealLimitState() const
Definition: dgBallConstraint.cpp:136
dgWorld
Definition: dgWorld.h:129
dgBallConstraint::GetJointForce
dgVector GetJointForce() const
Definition: dgBallConstraint.cpp:117
dgBallConstraint::GetTwistLimitState
bool GetTwistLimitState() const
Definition: dgBallConstraint.cpp:126
dgBallConstraint::m_lateralLimit
dgUnsigned32 m_lateralLimit
Definition: dgBallConstraint.h:74