diff options
author | dan miller | 2007-10-19 04:28:53 +0000 |
---|---|---|
committer | dan miller | 2007-10-19 04:28:53 +0000 |
commit | 0fc46fc9590912bf6925c899edd02d7a2cdf5f79 (patch) | |
tree | 51bcae7a1b8381a6bf6fd8025a7de1e30fe0045d /libraries/ode-0.9\/contrib/BreakableJoints/diff/joint.cpp.diff | |
parent | small bit of refactoring (diff) | |
download | opensim-SC_OLD-0fc46fc9590912bf6925c899edd02d7a2cdf5f79.zip opensim-SC_OLD-0fc46fc9590912bf6925c899edd02d7a2cdf5f79.tar.gz opensim-SC_OLD-0fc46fc9590912bf6925c899edd02d7a2cdf5f79.tar.bz2 opensim-SC_OLD-0fc46fc9590912bf6925c899edd02d7a2cdf5f79.tar.xz |
adding ode source to /libraries
Diffstat (limited to 'libraries/ode-0.9\/contrib/BreakableJoints/diff/joint.cpp.diff')
-rwxr-xr-x | libraries/ode-0.9\/contrib/BreakableJoints/diff/joint.cpp.diff | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/libraries/ode-0.9\/contrib/BreakableJoints/diff/joint.cpp.diff b/libraries/ode-0.9\/contrib/BreakableJoints/diff/joint.cpp.diff new file mode 100755 index 0000000..80397f0 --- /dev/null +++ b/libraries/ode-0.9\/contrib/BreakableJoints/diff/joint.cpp.diff | |||
@@ -0,0 +1,148 @@ | |||
1 | 2659,2804d2658 | ||
2 | < | ||
3 | < /******************** breakable joint contribution ***********************/ | ||
4 | < extern "C" void dJointSetBreakable (dxJoint *joint, int b) { | ||
5 | < dAASSERT(joint); | ||
6 | < if (b) { | ||
7 | < // we want this joint to be breakable but we must first check if it | ||
8 | < // was already breakable | ||
9 | < if (!joint->breakInfo) { | ||
10 | < // allocate a dxJointBreakInfo struct | ||
11 | < joint->breakInfo = new dxJointBreakInfo; | ||
12 | < joint->breakInfo->flags = 0; | ||
13 | < for (int i = 0; i < 3; i++) { | ||
14 | < joint->breakInfo->b1MaxF[0] = 0; | ||
15 | < joint->breakInfo->b1MaxT[0] = 0; | ||
16 | < joint->breakInfo->b2MaxF[0] = 0; | ||
17 | < joint->breakInfo->b2MaxT[0] = 0; | ||
18 | < } | ||
19 | < joint->breakInfo->callback = 0; | ||
20 | < } | ||
21 | < else { | ||
22 | < // the joint was already breakable | ||
23 | < return; | ||
24 | < } | ||
25 | < } | ||
26 | < else { | ||
27 | < // we want this joint to be unbreakable mut we must first check if | ||
28 | < // it is alreay unbreakable | ||
29 | < if (joint->breakInfo) { | ||
30 | < // deallocate the dxJointBreakInfo struct | ||
31 | < delete joint->breakInfo; | ||
32 | < joint->breakInfo = 0; | ||
33 | < } | ||
34 | < else { | ||
35 | < // the joint was already unbreakable | ||
36 | < return; | ||
37 | < } | ||
38 | < } | ||
39 | < } | ||
40 | < | ||
41 | < extern "C" void dJointSetBreakCallback (dxJoint *joint, dJointBreakCallback *callbackFunc) { | ||
42 | < dAASSERT(joint); | ||
43 | < # ifndef dNODEBUG | ||
44 | < // only works for a breakable joint | ||
45 | < if (!joint->breakInfo) { | ||
46 | < dDebug (0, "dJointSetBreakCallback called on unbreakable joint"); | ||
47 | < } | ||
48 | < # endif | ||
49 | < joint->breakInfo->callback = callbackFunc; | ||
50 | < } | ||
51 | < | ||
52 | < extern "C" void dJointSetBreakMode (dxJoint *joint, int mode) { | ||
53 | < dAASSERT(joint); | ||
54 | < # ifndef dNODEBUG | ||
55 | < // only works for a breakable joint | ||
56 | < if (!joint->breakInfo) { | ||
57 | < dDebug (0, "dJointSetBreakMode called on unbreakable joint"); | ||
58 | < } | ||
59 | < # endif | ||
60 | < joint->breakInfo->flags = mode; | ||
61 | < } | ||
62 | < | ||
63 | < extern "C" int dJointGetBreakMode (dxJoint *joint) { | ||
64 | < dAASSERT(joint); | ||
65 | < # ifndef dNODEBUG | ||
66 | < // only works for a breakable joint | ||
67 | < if (!joint->breakInfo) { | ||
68 | < dDebug (0, "dJointGetBreakMode called on unbreakable joint"); | ||
69 | < } | ||
70 | < # endif | ||
71 | < return joint->breakInfo->flags; | ||
72 | < } | ||
73 | < | ||
74 | < extern "C" void dJointSetBreakForce (dxJoint *joint, int body, dReal x, dReal y, dReal z) { | ||
75 | < dAASSERT(joint); | ||
76 | < # ifndef dNODEBUG | ||
77 | < // only works for a breakable joint | ||
78 | < if (!joint->breakInfo) { | ||
79 | < dDebug (0, "dJointSetBreakForce called on unbreakable joint"); | ||
80 | < } | ||
81 | < # endif | ||
82 | < if (body) { | ||
83 | < joint->breakInfo->b2MaxF[0] = x; | ||
84 | < joint->breakInfo->b2MaxF[1] = y; | ||
85 | < joint->breakInfo->b2MaxF[2] = z; | ||
86 | < } | ||
87 | < else { | ||
88 | < joint->breakInfo->b1MaxF[0] = x; | ||
89 | < joint->breakInfo->b1MaxF[1] = y; | ||
90 | < joint->breakInfo->b1MaxF[2] = z; | ||
91 | < } | ||
92 | < } | ||
93 | < | ||
94 | < extern "C" void dJointSetBreakTorque (dxJoint *joint, int body, dReal x, dReal y, dReal z) { | ||
95 | < dAASSERT(joint); | ||
96 | < # ifndef dNODEBUG | ||
97 | < // only works for a breakable joint | ||
98 | < if (!joint->breakInfo) { | ||
99 | < dDebug (0, "dJointSetBreakTorque called on unbreakable joint"); | ||
100 | < } | ||
101 | < # endif | ||
102 | < if (body) { | ||
103 | < joint->breakInfo->b2MaxT[0] = x; | ||
104 | < joint->breakInfo->b2MaxT[1] = y; | ||
105 | < joint->breakInfo->b2MaxT[2] = z; | ||
106 | < } | ||
107 | < else { | ||
108 | < joint->breakInfo->b1MaxT[0] = x; | ||
109 | < joint->breakInfo->b1MaxT[1] = y; | ||
110 | < joint->breakInfo->b1MaxT[2] = z; | ||
111 | < } | ||
112 | < } | ||
113 | < | ||
114 | < extern "C" int dJointIsBreakable (dxJoint *joint) { | ||
115 | < dAASSERT(joint); | ||
116 | < return joint->breakInfo != 0; | ||
117 | < } | ||
118 | < | ||
119 | < extern "C" void dJointGetBreakForce (dxJoint *joint, int body, dReal *force) { | ||
120 | < dAASSERT(joint); | ||
121 | < # ifndef dNODEBUG | ||
122 | < // only works for a breakable joint | ||
123 | < if (!joint->breakInfo) { | ||
124 | < dDebug (0, "dJointGetBreakForce called on unbreakable joint"); | ||
125 | < } | ||
126 | < # endif | ||
127 | < if (body) | ||
128 | < for (int i=0; i<3; i++) force[i]=joint->breakInfo->b2MaxF[i]; | ||
129 | < else | ||
130 | < for (int i=0; i<3; i++) force[i]=joint->breakInfo->b1MaxF[i]; | ||
131 | < } | ||
132 | < | ||
133 | < extern "C" void dJointGetBreakTorque (dxJoint *joint, int body, dReal *torque) { | ||
134 | < dAASSERT(joint); | ||
135 | < # ifndef dNODEBUG | ||
136 | < // only works for a breakable joint | ||
137 | < if (!joint->breakInfo) { | ||
138 | < dDebug (0, "dJointGetBreakTorque called on unbreakable joint"); | ||
139 | < } | ||
140 | < # endif | ||
141 | < if (body) | ||
142 | < for (int i=0; i<3; i++) torque[i]=joint->breakInfo->b2MaxT[i]; | ||
143 | < else | ||
144 | < for (int i=0; i<3; i++) torque[i]=joint->breakInfo->b1MaxT[i]; | ||
145 | < } | ||
146 | < /*************************************************************************/ | ||
147 | < | ||
148 | \ No newline at end of file | ||