22 #define thisTTClass QuaternionUnit
23 #define thisTTClassName "unit.quaternion"
24 #define thisTTClassTags "dataspace.unit, orientation"
30 QuaternionUnit::~QuaternionUnit(){;}
47 #undef thisTTClassName
48 #undef thisTTClassTags
52 #define thisTTClass EulerUnit
53 #define thisTTClassName "unit.euler"
54 #define thisTTClassTags "dataspace.unit, orientation"
60 EulerUnit::~EulerUnit(){;}
80 TTFloat64 cosPitchCosRoll(cosPitch*cosRoll);
81 TTFloat64 sinPitchSinRoll(sinPitch*sinRoll);
84 output[0] = cosYaw * sinPitch * cosRoll - sinYaw * cosPitch * sinRoll;
85 output[1] = cosYaw * cosPitch * sinRoll + sinYaw * sinPitch * cosRoll;
86 output[2] = sinYaw * cosPitchCosRoll + cosYaw * sinPitchSinRoll;
87 output[3] = cosYaw * cosPitchCosRoll - sinYaw * sinPitchSinRoll;
111 #undef thisTTClassName
112 #undef thisTTClassTags
116 #define thisTTClass AxisUnit
117 #define thisTTClassName "unit.axis"
118 #define thisTTClassTags "dataspace.unit, orientation"
124 AxisUnit::~AxisUnit(){;}
137 sinAngle = sin(angle);
140 n = sqrt(x*x + y*y + z*z);
150 output[0] = x * n * sinAngle;
151 output[1] = y * n * sinAngle;
152 output[2] = z * n * sinAngle;
153 output[3] = cos(angle);
171 if ( fabs( sin_a ) < 0.0005 )
173 else sin_a = 1.0/sin_a;
175 output[0] = X * sin_a;
176 output[1] = Y * sin_a;
177 output[2] = Z * sin_a;
182 #undef thisTTClassName
183 #undef thisTTClassTags
187 #define thisTTClass OrientationDataspace
188 #define thisTTClassName "dataspace.orientation"
189 #define thisTTClassTags "foundationDataspaceLib, dataspace, orientation"
194 registerUnit(
TT(
"unit.euler"),
TT(
"euler"));
195 registerUnit(
TT(
"unit.euler"),
TT(
"ypr"));
196 registerUnit(
TT(
"unit.axis"),
TT(
"axis"));
197 registerUnit(
TT(
"unit.axis"),
TT(
"xyza"));
198 registerUnit(
TT(
"unit.quaternion"),
TT(
"quaternion"));
199 registerUnit(
TT(
"unit.quaternion"),
TT(
"quat"));
202 neutralUnit =
TT(
"quaternion");
205 setInputUnit(neutralUnit);
206 setOutputUnit(neutralUnit);
210 OrientationDataspace::~OrientationDataspace()
216 #undef thisTTClassName
217 #undef thisTTClassTags
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from axis unit to neutral unit.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to Euler.
double TTFloat64
64 bit floating point number
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
TTFOUNDATION_EXPORT const TTFloat64 kTTRadiansToDegrees
Factor constant for converting radians to degrees.
Specification for the base class of each DataspaceUnit.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to axis unit.
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from Euler to neutral unit.
TTFOUNDATION_EXPORT const TTFloat64 kTTDegreesToRadians
Factor constant for converting degrees to radians.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to quarternian.
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from quarternian to neutral unit.
TT_OBJECT_CONSTRUCTOR
Constructor macro.
void resize(size_type n)
Change the number of elements.
[doxygenAppendixC_copyExample]
The OrientationDataspace converts between different untis describing orientation. ...