23 #include "worldsimconfig.h"
24 #include "qglviewer/vec.h"
36 template <
bool Shared>
68 template <
bool Shared = false>
74 template <
bool OtherShared>
77 wVectorT(
const wVectorT& );
79 wVectorT(
const real *ptr );
81 wVectorT( real *ptr );
83 wVectorT( real x, real y, real z, real w=1.0 );
93 wVectorT& normalize();
96 real& operator[](
int i );
98 const real& operator[](
int i )
const;
103 const wVectorT& operator+()
const;
106 template <
bool OtherShared>
109 template <
bool OtherShared>
112 wVectorT& operator=(
const wVectorT &A );
114 template <
bool OtherShared>
117 template <
bool OtherShared>
120 template <
bool OtherShared>
124 template <
bool OtherShared>
128 template <
bool OtherShared>
132 template <
bool OtherShared>
136 template <
bool OtherShared>
143 template <
bool SharedA,
bool SharedB>
170 template <
bool Shared>
175 template <
bool Shared>
180 template <
bool Shared>
199 template <
bool OtherShared>
201 x(InternalData<false>::data[0]),
202 y(InternalData<false>::data[1]),
203 z(InternalData<false>::data[2]),
204 w(InternalData<false>::data[3])
214 x(InternalData<false>::data[0]),
215 y(InternalData<false>::data[1]),
216 z(InternalData<false>::data[2]),
217 w(InternalData<false>::data[3])
227 x(InternalData<false>::data[0]),
228 y(InternalData<false>::data[1]),
229 z(InternalData<false>::data[2]),
230 w(InternalData<false>::data[3])
238 template <
bool Shared>
263 x(InternalData<false>::data[0]),
264 y(InternalData<false>::data[1]),
265 z(InternalData<false>::data[2]),
266 w(InternalData<false>::data[3])
274 template <
bool Shared>
279 template <
bool Shared>
284 template <
bool Shared>
289 template <
bool Shared>
294 template <
bool Shared>
297 real n = sqrt(
self%
self );
305 template <
bool Shared>
310 template <
bool Shared>
315 template <
bool Shared>
316 template <
bool OtherShared>
321 template <
bool Shared>
322 template <
bool OtherShared>
327 template <
bool Shared>
337 template <
bool Shared>
338 template <
bool OtherShared>
347 template <
bool Shared>
348 template <
bool OtherShared>
357 template <
bool Shared>
358 template <
bool OtherShared>
367 template <
bool Shared>
368 template <
bool OtherShared>
370 return ( x==A.x && y==A.y && z==A.z );
373 template <
bool Shared>
374 template <
bool OtherShared>
376 return x*A.x + y*A.y + z*A.z;
379 template <
bool Shared>
380 template <
bool OtherShared>
389 template <
bool Shared>
390 template <
bool OtherShared>
395 template <
bool Shared>
397 return sqrt( x*x + y*y + z*z );
400 template <
bool Shared>
401 template <
bool SharedA,
bool SharedB>
403 return sqrt( (A.x-B.x)*(A.x-B.x) + (A.y-B.y)*(A.y-B.y) + (A.z-B.z)*(A.z-B.z) );
406 template <
bool Shared>
410 double costheta, sintheta;
412 costheta = cos(theta);
413 sintheta = sin(theta);
414 q.x += (costheta + (1 - costheta) * axis.x * axis.x) * x;
415 q.x += ((1 - costheta) * axis.x * axis.y - axis.z * sintheta) * y;
416 q.x += ((1 - costheta) * axis.x * axis.z + axis.y * sintheta) * z;
418 q.y += ((1 - costheta) * axis.x * axis.y + axis.z * sintheta) * x;
419 q.y += (costheta + (1 - costheta) * axis.y * axis.y) * y;
420 q.y += ((1 - costheta) * axis.y * axis.z - axis.x * sintheta) * z;
422 q.z += ((1 - costheta) * axis.x * axis.z - axis.y * sintheta) * x;
423 q.z += ((1 - costheta) * axis.y * axis.z + axis.x * sintheta) * y;
424 q.z += (costheta + (1 - costheta) * axis.z * axis.z) * z;