66 union { GLfloat M00; GLfloat
XX; GLfloat SX; };
67 union { GLfloat M10; GLfloat
XY; };
68 union { GLfloat M20; GLfloat
XZ; };
69 union { GLfloat M01; GLfloat
YX; };
70 union { GLfloat M11; GLfloat
YY; GLfloat SY; };
71 union { GLfloat M21; GLfloat
YZ; };
72 union { GLfloat M02; GLfloat
ZX; };
73 union { GLfloat M12; GLfloat
ZY; };
74 union { GLfloat M22; GLfloat
ZZ; GLfloat SZ; };
84 union { GLfloat M00; GLfloat
XX; GLfloat SX; };
85 union { GLfloat M10; GLfloat
XY; };
86 union { GLfloat M20; GLfloat
XZ; };
87 union { GLfloat M30; GLfloat
XW; };
88 union { GLfloat M01; GLfloat
YX; };
89 union { GLfloat M11; GLfloat
YY; GLfloat SY; };
90 union { GLfloat M21; GLfloat
YZ; };
91 union { GLfloat M31; GLfloat
YW; };
92 union { GLfloat M02; GLfloat
ZX; };
93 union { GLfloat M12; GLfloat
ZY; };
94 union { GLfloat M22; GLfloat
ZZ; GLfloat SZ; };
95 union { GLfloat M32; GLfloat
ZW; };
96 union { GLfloat M03; GLfloat
TX; };
97 union { GLfloat M13; GLfloat
TY; };
98 union { GLfloat M23; GLfloat
TZ; };
99 union { GLfloat M33; GLfloat
TW; GLfloat SW; };
106 #define Point2fT Tuple2fT //A 2 element point that is represented by single precision floating point x,y coordinates.
108 #define Quat4fT Tuple4fT //A 4 element unit quaternion represented by single precision floating point x,y,z,w coordinates.
110 #define Vector2fT Tuple2fT //A 2-element vector that is represented by single-precision floating point x,y coordinates.
111 #define Vector3fT Tuple3fT //A 3-element vector that is represented by single-precision floating point x,y,z coordinates.
114 #define FuncSqrt sqrtf
118 # define Epsilon 1.0e-5
131 NewObj->s.X += t1->s.X;
132 NewObj->s.Y += t1->s.Y;
144 NewObj->s.X -= t1->s.X;
145 NewObj->s.Y -= t1->s.Y;
163 Result.s.X =(v1->s.Y * v2->s.Z) -(v1->s.Z * v2->s.Y);
164 Result.s.Y =(v1->s.Z * v2->s.X) -(v1->s.X * v2->s.Z);
165 Result.s.Z =(v1->s.X * v2->s.Y) -(v1->s.Y * v2->s.X);
180 return (NewObj->s.X * v1->s.X) +
181 (NewObj->s.Y * v1->s.Y) +
182 (NewObj->s.Z * v1->s.Z);
190 static GLfloat Vector3fLengthSquared(
const Vector3fT* NewObj)
194 return (NewObj->s.X * NewObj->s.X) +
195 (NewObj->s.Y * NewObj->s.Y) +
196 (NewObj->s.Z * NewObj->s.Z);
204 static GLfloat Vector3fLength(
const Vector3fT* NewObj)
208 return FuncSqrt(Vector3fLengthSquared(NewObj));
212 static void Matrix3fSetZero(
Matrix3fT* NewObj)
214 NewObj->s.M00 = NewObj->s.M01 = NewObj->s.M02 =
215 NewObj->s.M10 = NewObj->s.M11 = NewObj->s.M12 =
216 NewObj->s.M20 = NewObj->s.M21 = NewObj->s.M22 = 0.0f;
223 static void Matrix3fSetIdentity(
Matrix3fT* NewObj)
225 Matrix3fSetZero(NewObj);
230 NewObj->s.M22 = 1.0f;
240 static void Matrix3fSetRotationFromQuat4f(
Matrix3fT* NewObj,
const Quat4fT* q1)
250 n =(q1->s.X * q1->s.X) +(q1->s.Y * q1->s.Y) +(q1->s.Z * q1->s.Z) +(q1->s.W * q1->s.W);
251 s =(n > 0.0f) ?(2.0f / n) : 0.0f;
253 xs = q1->s.X * s; ys = q1->s.Y * s; zs = q1->s.Z * s;
254 wx = q1->s.W * xs; wy = q1->s.W * ys; wz = q1->s.W * zs;
255 xx = q1->s.X * xs; xy = q1->s.X * ys; xz = q1->s.X * zs;
256 yy = q1->s.Y * ys; yz = q1->s.Y * zs; zz = q1->s.Z * zs;
258 NewObj->s.XX = 1.0f -(yy + zz); NewObj->s.YX = xy - wz; NewObj->s.ZX = xz + wy;
259 NewObj->s.XY = xy + wz; NewObj->s.YY = 1.0f -(xx + zz); NewObj->s.ZY = yz - wx;
260 NewObj->s.XZ = xz - wy; NewObj->s.YZ = yz + wx; NewObj->s.ZZ = 1.0f -(xx + yy);
276 Result.s.M00 =(NewObj->s.M00 * m1->s.M00) +(NewObj->s.M01 * m1->s.M10) +(NewObj->s.M02 * m1->s.M20);
277 Result.s.M01 =(NewObj->s.M00 * m1->s.M01) +(NewObj->s.M01 * m1->s.M11) +(NewObj->s.M02 * m1->s.M21);
278 Result.s.M02 =(NewObj->s.M00 * m1->s.M02) +(NewObj->s.M01 * m1->s.M12) +(NewObj->s.M02 * m1->s.M22);
280 Result.s.M10 =(NewObj->s.M10 * m1->s.M00) +(NewObj->s.M11 * m1->s.M10) +(NewObj->s.M12 * m1->s.M20);
281 Result.s.M11 =(NewObj->s.M10 * m1->s.M01) +(NewObj->s.M11 * m1->s.M11) +(NewObj->s.M12 * m1->s.M21);
282 Result.s.M12 =(NewObj->s.M10 * m1->s.M02) +(NewObj->s.M11 * m1->s.M12) +(NewObj->s.M12 * m1->s.M22);
284 Result.s.M20 =(NewObj->s.M20 * m1->s.M00) +(NewObj->s.M21 * m1->s.M10) +(NewObj->s.M22 * m1->s.M20);
285 Result.s.M21 =(NewObj->s.M20 * m1->s.M01) +(NewObj->s.M21 * m1->s.M11) +(NewObj->s.M22 * m1->s.M21);
286 Result.s.M22 =(NewObj->s.M20 * m1->s.M02) +(NewObj->s.M21 * m1->s.M12) +(NewObj->s.M22 * m1->s.M22);
293 static void Matrix4fSetRotationScaleFromMatrix4f(
Matrix4fT* NewObj,
const Matrix4fT* m1)
297 NewObj->s.XX = m1->s.XX; NewObj->s.YX = m1->s.YX; NewObj->s.ZX = m1->s.ZX;
298 NewObj->s.XY = m1->s.XY; NewObj->s.YY = m1->s.YY; NewObj->s.ZY = m1->s.ZY;
299 NewObj->s.XZ = m1->s.XZ; NewObj->s.YZ = m1->s.YZ; NewObj->s.ZZ = m1->s.ZZ;
321 ((NewObj->s.XX * NewObj->s.XX) +(NewObj->s.XY * NewObj->s.XY) +(NewObj->s.XZ * NewObj->s.XZ) +
322 (NewObj->s.YX * NewObj->s.YX) +(NewObj->s.YY * NewObj->s.YY) +(NewObj->s.YZ * NewObj->s.YZ) +
323 (NewObj->s.ZX * NewObj->s.ZX) +(NewObj->s.ZY * NewObj->s.ZY) +(NewObj->s.ZZ * NewObj->s.ZZ) ) / 3.0f );
328 rot3->s.XX = NewObj->s.XX; rot3->s.XY = NewObj->s.XY; rot3->s.XZ = NewObj->s.XZ;
329 rot3->s.YX = NewObj->s.YX; rot3->s.YY = NewObj->s.YY; rot3->s.YZ = NewObj->s.YZ;
330 rot3->s.ZX = NewObj->s.ZX; rot3->s.ZY = NewObj->s.ZY; rot3->s.ZZ = NewObj->s.ZZ;
334 n = 1.0f /
FuncSqrt((NewObj->s.XX * NewObj->s.XX) +
335 (NewObj->s.XY * NewObj->s.XY) +
336 (NewObj->s.XZ * NewObj->s.XZ) );
341 n = 1.0f /
FuncSqrt((NewObj->s.YX * NewObj->s.YX) +
342 (NewObj->s.YY * NewObj->s.YY) +
343 (NewObj->s.YZ * NewObj->s.YZ) );
348 n = 1.0f /
FuncSqrt((NewObj->s.ZX * NewObj->s.ZX) +
349 (NewObj->s.ZY * NewObj->s.ZY) +
350 (NewObj->s.ZZ * NewObj->s.ZZ) );
360 Matrix4fSetRotationScaleFromMatrix4f(rot4, NewObj);
365 n = 1.0f /
FuncSqrt((NewObj->s.XX * NewObj->s.XX) +
366 (NewObj->s.XY * NewObj->s.XY) +
367 (NewObj->s.XZ * NewObj->s.XZ) );
372 n = 1.0f /
FuncSqrt((NewObj->s.YX * NewObj->s.YX) +
373 (NewObj->s.YY * NewObj->s.YY) +
374 (NewObj->s.YZ * NewObj->s.YZ) );
379 n = 1.0f /
FuncSqrt((NewObj->s.ZX * NewObj->s.ZX) +
380 (NewObj->s.ZY * NewObj->s.ZY) +
381 (NewObj->s.ZZ * NewObj->s.ZZ) );
391 static void Matrix4fSetRotationScaleFromMatrix3f(
Matrix4fT* NewObj,
const Matrix3fT* m1)
395 NewObj->s.XX = m1->s.XX; NewObj->s.YX = m1->s.YX; NewObj->s.ZX = m1->s.ZX;
396 NewObj->s.XY = m1->s.XY; NewObj->s.YY = m1->s.YY; NewObj->s.ZY = m1->s.ZY;
397 NewObj->s.XZ = m1->s.XZ; NewObj->s.YZ = m1->s.YZ; NewObj->s.ZZ = m1->s.ZZ;
401 static void Matrix4fMulRotationScale(
Matrix4fT* NewObj, GLfloat scale)
405 NewObj->s.XX *= scale; NewObj->s.YX *= scale; NewObj->s.ZX *= scale;
406 NewObj->s.XY *= scale; NewObj->s.YY *= scale; NewObj->s.ZY *= scale;
407 NewObj->s.XZ *= scale; NewObj->s.YZ *= scale; NewObj->s.ZZ *= scale;
427 scale = Matrix4fSVD(NewObj, NULL, NULL);
429 Matrix4fSetRotationScaleFromMatrix3f(NewObj, m1);
430 Matrix4fMulRotationScale(NewObj, scale);
448 ArcBall_t(GLfloat NewWidth, GLfloat NewHeight);
458 this->AdjustWidth = 1.0f /((NewWidth - 1.0f) * 0.5f);
459 this->AdjustHeight = 1.0f /((NewHeight - 1.0f) * 0.5f);
void setBounds(GLfloat NewWidth, GLfloat NewHeight)
union LIBMOLDEO_API Tuple3f_t Tuple3fT
union LIBMOLDEO_API Tuple4f_t Tuple4fT
union LIBMOLDEO_API Tuple2f_t Tuple2fT
class LIBMOLDEO_API ArcBall_t ArcBallT
Objeto para la rotación esférica de la vista 3d.
The projection component of space.
union LIBMOLDEO_API Matrix3f_t Matrix3fT
The Y component of space.
The X component of space.
Objeto para la rotación esférica de la vista 3d.
union LIBMOLDEO_API Matrix4f_t Matrix4fT