30 |
|
/*! \class vector3 |
31 |
|
\brief Represents a vector in the 3-dimensional real space. |
32 |
|
|
33 |
< |
The vector3 class was designed to simplify operations with doubleing |
33 |
> |
The vector3 class was designed to simplify operations with floating |
34 |
|
point coordinates. To this end many of the common operations have been |
35 |
|
overloaded for simplicity. Vector addition, subtraction, scalar |
36 |
|
multiplication, dot product, cross product, magnitude and a number of |
142 |
|
|
143 |
|
\warning If length() is very close to zero, but not == 0.0, |
144 |
|
this method may behave in unexpected ways and return almost |
145 |
< |
random results; details may depend on your particular doubleing |
145 |
> |
random results; details may depend on your particular floating |
146 |
|
point implementation. The use of this method is therefore |
147 |
|
highly discouraged, unless you are certain that length() is in |
148 |
|
a reasonable range, away from 0.0 (Stefan Kebekus) |
192 |
|
length() of the two vectors is very close to 0.0, but not == |
193 |
|
0.0, this method may behave in unexpected ways and return |
194 |
|
almost random results; details may depend on your particular |
195 |
< |
doubleing point implementation. The use of this method is |
195 |
> |
floating point implementation. The use of this method is |
196 |
|
therefore highly discouraged, unless you are certain that the |
197 |
|
length()es are in a reasonable range, away from 0.0 (Stefan |
198 |
|
Kebekus) |
224 |
|
return((RAD_TO_DEG * acos(dp))); |
225 |
|
} |
226 |
|
|
227 |
+ |
/*! This function calculates the torsion angle of three vectors, represented |
228 |
+ |
by four points A--B--C--D, i.e. B and C are vertexes, but none of A--B, |
229 |
+ |
B--C, and C--D are colinear. A "torsion angle" is the amount of "twist" |
230 |
+ |
or torsion needed around the B--C axis to bring A--B into the same plane |
231 |
+ |
as B--C--D. The torsion is measured by "looking down" the vector B--C so |
232 |
+ |
that B is superimposed on C, then noting how far you'd have to rotate |
233 |
+ |
A--B to superimpose A over D. Angles are + in the anticlockwise |
234 |
+ |
direction. The operation is symmetrical in that if you reverse the image |
235 |
+ |
(look from C to B and rotate D over A), you get the same answer. |
236 |
+ |
*/ |
237 |
+ |
|
238 |
|
OBAPI double CalcTorsionAngle(const vector3 &a, const vector3 &b, |
239 |
|
const vector3 &c, const vector3 &d) |
240 |
|
{ |