diff options
author | dan miller | 2007-10-19 05:24:38 +0000 |
---|---|---|
committer | dan miller | 2007-10-19 05:24:38 +0000 |
commit | f205de7847da7ae1c10212d82e7042d0100b4ce0 (patch) | |
tree | 9acc9608a6880502aaeda43af52c33e278e95b9c /libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp | |
parent | trying to fix my screwup part deux (diff) | |
download | opensim-SC_OLD-f205de7847da7ae1c10212d82e7042d0100b4ce0.zip opensim-SC_OLD-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.gz opensim-SC_OLD-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.bz2 opensim-SC_OLD-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.xz |
from the start... checking in ode-0.9
Diffstat (limited to 'libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp')
-rw-r--r-- | libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp b/libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp new file mode 100644 index 0000000..d9336c9 --- /dev/null +++ b/libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp | |||
@@ -0,0 +1,79 @@ | |||
1 | #include "StdAfx.h" | ||
2 | |||
3 | #include <ode/ode.h> | ||
4 | #include "jointball.h" | ||
5 | |||
6 | namespace ODEManaged | ||
7 | { | ||
8 | |||
9 | //Constructors | ||
10 | |||
11 | JointBall::JointBall(void) : Joint(){} | ||
12 | |||
13 | |||
14 | JointBall::JointBall(World &world) | ||
15 | { | ||
16 | if(this->_id) dJointDestroy(this->_id); | ||
17 | _id = dJointCreateBall(world.Id(), 0); | ||
18 | } | ||
19 | |||
20 | |||
21 | JointBall::JointBall(World &world, JointGroup &jointGroup) | ||
22 | { | ||
23 | if(this->_id) dJointDestroy(this->_id); | ||
24 | _id = dJointCreateBall(world.Id(), jointGroup.Id()); | ||
25 | } | ||
26 | |||
27 | |||
28 | //Destructor | ||
29 | |||
30 | JointBall::~JointBall(void){} | ||
31 | |||
32 | |||
33 | //Methods | ||
34 | |||
35 | //Overloaded Create | ||
36 | void JointBall::Create(World &world, JointGroup &jointGroup) | ||
37 | { | ||
38 | if(this->_id) dJointDestroy(this->_id); | ||
39 | _id = dJointCreateBall(world.Id(), jointGroup.Id()); | ||
40 | } | ||
41 | |||
42 | void JointBall::Create(World &world) | ||
43 | { | ||
44 | if(this->_id) dJointDestroy(this->_id); | ||
45 | _id = dJointCreateBall(world.Id(), 0); | ||
46 | } | ||
47 | |||
48 | |||
49 | //Overloaded Attach | ||
50 | void JointBall::Attach(Body &body1, Body &body2) | ||
51 | { | ||
52 | dJointAttach(this->_id, body1.Id(), body2.Id()); | ||
53 | } | ||
54 | |||
55 | void JointBall::Attach(Body &body1) | ||
56 | { | ||
57 | dJointAttach(this->_id, body1.Id(), 0); | ||
58 | } | ||
59 | |||
60 | |||
61 | //SetAnchor | ||
62 | void JointBall::SetAnchor(double x, double y ,double z) | ||
63 | { | ||
64 | dJointSetBallAnchor(this->_id, x, y, z); | ||
65 | } | ||
66 | |||
67 | //GetAnchor | ||
68 | Vector3 JointBall::GetAnchor(void) | ||
69 | { | ||
70 | Vector3 retVal; | ||
71 | dVector3 temp; | ||
72 | dJointGetBallAnchor(this->_id,temp); | ||
73 | retVal.x = temp[0]; | ||
74 | retVal.y = temp[1]; | ||
75 | retVal.z = temp[2]; | ||
76 | return retVal; | ||
77 | } | ||
78 | |||
79 | } | ||