Bullet Collision Detection & Physics Library
sse/vectormath_aos.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms,
6  with or without modification, are permitted provided that the
7  following conditions are met:
8  * Redistributions of source code must retain the above copyright
9  notice, this list of conditions and the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in the
12  documentation and/or other materials provided with the distribution.
13  * Neither the name of the Sony Computer Entertainment Inc nor the names
14  of its contributors may be used to endorse or promote products derived
15  from this software without specific prior written permission.
16 
17  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  POSSIBILITY OF SUCH DAMAGE.
28 */
29 
30 
31 #ifndef _VECTORMATH_AOS_CPP_SSE_H
32 #define _VECTORMATH_AOS_CPP_SSE_H
33 
34 #include <math.h>
35 #include <xmmintrin.h>
36 #include <emmintrin.h>
37 #include <assert.h>
38 
39 #define Vector3Ref Vector3&
40 #define QuatRef Quat&
41 #define Matrix3Ref Matrix3&
42 
43 #if (defined (_WIN32) && (_MSC_VER) && _MSC_VER >= 1400)
44  #define USE_SSE3_LDDQU
45 
46  #define VM_ATTRIBUTE_ALIGNED_CLASS16(a) __declspec(align(16)) a
47  #define VM_ATTRIBUTE_ALIGN16 __declspec(align(16))
48  #define VECTORMATH_FORCE_INLINE __forceinline
49 #else
50  #define VM_ATTRIBUTE_ALIGNED_CLASS16(a) a __attribute__ ((aligned (16)))
51  #define VM_ATTRIBUTE_ALIGN16 __attribute__ ((aligned (16)))
52  #define VECTORMATH_FORCE_INLINE inline __attribute__ ((always_inline))
53  #ifdef __SSE3__
54  #define USE_SSE3_LDDQU
55  #endif //__SSE3__
56 #endif//_WIN32
57 
58 
59 #ifdef USE_SSE3_LDDQU
60 #include <pmmintrin.h>//_mm_lddqu_si128
61 #endif //USE_SSE3_LDDQU
62 
63 
64 // TODO: Tidy
65 typedef __m128 vec_float4;
66 typedef __m128 vec_uint4;
67 typedef __m128 vec_int4;
68 typedef __m128i vec_uchar16;
69 typedef __m128i vec_ushort8;
70 
71 #define vec_splat(x, e) _mm_shuffle_ps(x, x, _MM_SHUFFLE(e,e,e,e))
72 
73 #define _mm_ror_ps(vec,i) \
74  (((i)%4) ? (_mm_shuffle_ps(vec,vec, _MM_SHUFFLE((unsigned char)(i+3)%4,(unsigned char)(i+2)%4,(unsigned char)(i+1)%4,(unsigned char)(i+0)%4))) : (vec))
75 #define _mm_rol_ps(vec,i) \
76  (((i)%4) ? (_mm_shuffle_ps(vec,vec, _MM_SHUFFLE((unsigned char)(7-i)%4,(unsigned char)(6-i)%4,(unsigned char)(5-i)%4,(unsigned char)(4-i)%4))) : (vec))
77 
78 #define vec_sld(vec,vec2,x) _mm_ror_ps(vec, ((x)/4))
79 
80 #define _mm_abs_ps(vec) _mm_andnot_ps(_MASKSIGN_,vec)
81 #define _mm_neg_ps(vec) _mm_xor_ps(_MASKSIGN_,vec)
82 
83 #define vec_madd(a, b, c) _mm_add_ps(c, _mm_mul_ps(a, b) )
84 
85 union SSEFloat
86 {
87  __m128i vi;
88  __m128 m128;
89  __m128 vf;
90  unsigned int ui[4];
91  unsigned short s[8];
92  float f[4];
93  SSEFloat(__m128 v) : m128(v) {}
94  SSEFloat(__m128i v) : vi(v) {}
95  SSEFloat() {}//uninitialized
96 };
97 
98 static VECTORMATH_FORCE_INLINE __m128 vec_sel(__m128 a, __m128 b, __m128 mask)
99 {
100  return _mm_or_ps(_mm_and_ps(mask, b), _mm_andnot_ps(mask, a));
101 }
102 static VECTORMATH_FORCE_INLINE __m128 vec_sel(__m128 a, __m128 b, const unsigned int *_mask)
103 {
104  return vec_sel(a, b, _mm_load_ps((float *)_mask));
105 }
106 static VECTORMATH_FORCE_INLINE __m128 vec_sel(__m128 a, __m128 b, unsigned int _mask)
107 {
108  return vec_sel(a, b, _mm_set1_ps(*(float *)&_mask));
109 }
110 
111 static VECTORMATH_FORCE_INLINE __m128 toM128(unsigned int x)
112 {
113  return _mm_set1_ps( *(float *)&x );
114 }
115 
116 static VECTORMATH_FORCE_INLINE __m128 fabsf4(__m128 x)
117 {
118  return _mm_and_ps( x, toM128( 0x7fffffff ) );
119 }
120 /*
121 union SSE64
122 {
123  __m128 m128;
124  struct
125  {
126  __m64 m01;
127  __m64 m23;
128  } m64;
129 };
130 
131 static VECTORMATH_FORCE_INLINE __m128 vec_cts(__m128 x, int a)
132 {
133  assert(a == 0); // Only 2^0 supported
134  (void)a;
135  SSE64 sse64;
136  sse64.m64.m01 = _mm_cvttps_pi32(x);
137  sse64.m64.m23 = _mm_cvttps_pi32(_mm_ror_ps(x,2));
138  _mm_empty();
139  return sse64.m128;
140 }
141 
142 static VECTORMATH_FORCE_INLINE __m128 vec_ctf(__m128 x, int a)
143 {
144  assert(a == 0); // Only 2^0 supported
145  (void)a;
146  SSE64 sse64;
147  sse64.m128 = x;
148  __m128 result =_mm_movelh_ps(
149  _mm_cvt_pi2ps(_mm_setzero_ps(), sse64.m64.m01),
150  _mm_cvt_pi2ps(_mm_setzero_ps(), sse64.m64.m23));
151  _mm_empty();
152  return result;
153 }
154 */
155 static VECTORMATH_FORCE_INLINE __m128 vec_cts(__m128 x, int a)
156 {
157  assert(a == 0); // Only 2^0 supported
158  (void)a;
159  __m128i result = _mm_cvtps_epi32(x);
160  return (__m128 &)result;
161 }
162 
163 static VECTORMATH_FORCE_INLINE __m128 vec_ctf(__m128 x, int a)
164 {
165  assert(a == 0); // Only 2^0 supported
166  (void)a;
167  return _mm_cvtepi32_ps((__m128i &)x);
168 }
169 
170 #define vec_nmsub(a,b,c) _mm_sub_ps( c, _mm_mul_ps( a, b ) )
171 #define vec_sub(a,b) _mm_sub_ps( a, b )
172 #define vec_add(a,b) _mm_add_ps( a, b )
173 #define vec_mul(a,b) _mm_mul_ps( a, b )
174 #define vec_xor(a,b) _mm_xor_ps( a, b )
175 #define vec_and(a,b) _mm_and_ps( a, b )
176 #define vec_cmpeq(a,b) _mm_cmpeq_ps( a, b )
177 #define vec_cmpgt(a,b) _mm_cmpgt_ps( a, b )
178 
179 #define vec_mergeh(a,b) _mm_unpacklo_ps( a, b )
180 #define vec_mergel(a,b) _mm_unpackhi_ps( a, b )
181 
182 #define vec_andc(a,b) _mm_andnot_ps( b, a )
183 
184 #define sqrtf4(x) _mm_sqrt_ps( x )
185 #define rsqrtf4(x) _mm_rsqrt_ps( x )
186 #define recipf4(x) _mm_rcp_ps( x )
187 #define negatef4(x) _mm_sub_ps( _mm_setzero_ps(), x )
188 
189 static VECTORMATH_FORCE_INLINE __m128 newtonrapson_rsqrt4( const __m128 v )
190 {
191 #define _half4 _mm_setr_ps(.5f,.5f,.5f,.5f)
192 #define _three _mm_setr_ps(3.f,3.f,3.f,3.f)
193 const __m128 approx = _mm_rsqrt_ps( v );
194 const __m128 muls = _mm_mul_ps(_mm_mul_ps(v, approx), approx);
195 return _mm_mul_ps(_mm_mul_ps(_half4, approx), _mm_sub_ps(_three, muls) );
196 }
197 
198 static VECTORMATH_FORCE_INLINE __m128 acosf4(__m128 x)
199 {
200  __m128 xabs = fabsf4(x);
201  __m128 select = _mm_cmplt_ps( x, _mm_setzero_ps() );
202  __m128 t1 = sqrtf4(vec_sub(_mm_set1_ps(1.0f), xabs));
203 
204  /* Instruction counts can be reduced if the polynomial was
205  * computed entirely from nested (dependent) fma's. However,
206  * to reduce the number of pipeline stalls, the polygon is evaluated
207  * in two halves (hi amd lo).
208  */
209  __m128 xabs2 = _mm_mul_ps(xabs, xabs);
210  __m128 xabs4 = _mm_mul_ps(xabs2, xabs2);
211  __m128 hi = vec_madd(vec_madd(vec_madd(_mm_set1_ps(-0.0012624911f),
212  xabs, _mm_set1_ps(0.0066700901f)),
213  xabs, _mm_set1_ps(-0.0170881256f)),
214  xabs, _mm_set1_ps( 0.0308918810f));
215  __m128 lo = vec_madd(vec_madd(vec_madd(_mm_set1_ps(-0.0501743046f),
216  xabs, _mm_set1_ps(0.0889789874f)),
217  xabs, _mm_set1_ps(-0.2145988016f)),
218  xabs, _mm_set1_ps( 1.5707963050f));
219 
220  __m128 result = vec_madd(hi, xabs4, lo);
221 
222  // Adjust the result if x is negactive.
223  return vec_sel(
224  vec_mul(t1, result), // Positive
225  vec_nmsub(t1, result, _mm_set1_ps(3.1415926535898f)), // Negative
226  select);
227 }
228 
230 {
231 
232 //
233 // Common constants used to evaluate sinf4/cosf4/tanf4
234 //
235 #define _SINCOS_CC0 -0.0013602249f
236 #define _SINCOS_CC1 0.0416566950f
237 #define _SINCOS_CC2 -0.4999990225f
238 #define _SINCOS_SC0 -0.0001950727f
239 #define _SINCOS_SC1 0.0083320758f
240 #define _SINCOS_SC2 -0.1666665247f
241 
242 #define _SINCOS_KC1 1.57079625129f
243 #define _SINCOS_KC2 7.54978995489e-8f
244 
245  vec_float4 xl,xl2,xl3,res;
246 
247  // Range reduction using : xl = angle * TwoOverPi;
248  //
249  xl = vec_mul(x, _mm_set1_ps(0.63661977236f));
250 
251  // Find the quadrant the angle falls in
252  // using: q = (int) (ceil(abs(xl))*sign(xl))
253  //
254  vec_int4 q = vec_cts(xl,0);
255 
256  // Compute an offset based on the quadrant that the angle falls in
257  //
258  vec_int4 offset = _mm_and_ps(q,toM128(0x3));
259 
260  // Remainder in range [-pi/4..pi/4]
261  //
262  vec_float4 qf = vec_ctf(q,0);
263  xl = vec_nmsub(qf,_mm_set1_ps(_SINCOS_KC2),vec_nmsub(qf,_mm_set1_ps(_SINCOS_KC1),x));
264 
265  // Compute x^2 and x^3
266  //
267  xl2 = vec_mul(xl,xl);
268  xl3 = vec_mul(xl2,xl);
269 
270  // Compute both the sin and cos of the angles
271  // using a polynomial expression:
272  // cx = 1.0f + xl2 * ((C0 * xl2 + C1) * xl2 + C2), and
273  // sx = xl + xl3 * ((S0 * xl2 + S1) * xl2 + S2)
274  //
275 
276  vec_float4 cx =
277  vec_madd(
278  vec_madd(
279  vec_madd(_mm_set1_ps(_SINCOS_CC0),xl2,_mm_set1_ps(_SINCOS_CC1)),xl2,_mm_set1_ps(_SINCOS_CC2)),xl2,_mm_set1_ps(1.0f));
280  vec_float4 sx =
281  vec_madd(
282  vec_madd(
283  vec_madd(_mm_set1_ps(_SINCOS_SC0),xl2,_mm_set1_ps(_SINCOS_SC1)),xl2,_mm_set1_ps(_SINCOS_SC2)),xl3,xl);
284 
285  // Use the cosine when the offset is odd and the sin
286  // when the offset is even
287  //
288  res = vec_sel(cx,sx,vec_cmpeq(vec_and(offset,
289  toM128(0x1)),
290  _mm_setzero_ps()));
291 
292  // Flip the sign of the result when (offset mod 4) = 1 or 2
293  //
294  return vec_sel(
295  vec_xor(toM128(0x80000000U), res), // Negative
296  res, // Positive
297  vec_cmpeq(vec_and(offset,toM128(0x2)),_mm_setzero_ps()));
298 }
299 
301 {
302  vec_float4 xl,xl2,xl3;
303  vec_int4 offsetSin, offsetCos;
304 
305  // Range reduction using : xl = angle * TwoOverPi;
306  //
307  xl = vec_mul(x, _mm_set1_ps(0.63661977236f));
308 
309  // Find the quadrant the angle falls in
310  // using: q = (int) (ceil(abs(xl))*sign(xl))
311  //
312  //vec_int4 q = vec_cts(vec_add(xl,vec_sel(_mm_set1_ps(0.5f),xl,(0x80000000))),0);
313  vec_int4 q = vec_cts(xl,0);
314 
315  // Compute the offset based on the quadrant that the angle falls in.
316  // Add 1 to the offset for the cosine.
317  //
318  offsetSin = vec_and(q,toM128((int)0x3));
319  __m128i temp = _mm_add_epi32(_mm_set1_epi32(1),(__m128i &)offsetSin);
320  offsetCos = (__m128 &)temp;
321 
322  // Remainder in range [-pi/4..pi/4]
323  //
324  vec_float4 qf = vec_ctf(q,0);
325  xl = vec_nmsub(qf,_mm_set1_ps(_SINCOS_KC2),vec_nmsub(qf,_mm_set1_ps(_SINCOS_KC1),x));
326 
327  // Compute x^2 and x^3
328  //
329  xl2 = vec_mul(xl,xl);
330  xl3 = vec_mul(xl2,xl);
331 
332  // Compute both the sin and cos of the angles
333  // using a polynomial expression:
334  // cx = 1.0f + xl2 * ((C0 * xl2 + C1) * xl2 + C2), and
335  // sx = xl + xl3 * ((S0 * xl2 + S1) * xl2 + S2)
336  //
337  vec_float4 cx =
338  vec_madd(
339  vec_madd(
340  vec_madd(_mm_set1_ps(_SINCOS_CC0),xl2,_mm_set1_ps(_SINCOS_CC1)),xl2,_mm_set1_ps(_SINCOS_CC2)),xl2,_mm_set1_ps(1.0f));
341  vec_float4 sx =
342  vec_madd(
343  vec_madd(
344  vec_madd(_mm_set1_ps(_SINCOS_SC0),xl2,_mm_set1_ps(_SINCOS_SC1)),xl2,_mm_set1_ps(_SINCOS_SC2)),xl3,xl);
345 
346  // Use the cosine when the offset is odd and the sin
347  // when the offset is even
348  //
349  vec_uint4 sinMask = (vec_uint4)vec_cmpeq(vec_and(offsetSin,toM128(0x1)),_mm_setzero_ps());
350  vec_uint4 cosMask = (vec_uint4)vec_cmpeq(vec_and(offsetCos,toM128(0x1)),_mm_setzero_ps());
351  *s = vec_sel(cx,sx,sinMask);
352  *c = vec_sel(cx,sx,cosMask);
353 
354  // Flip the sign of the result when (offset mod 4) = 1 or 2
355  //
356  sinMask = vec_cmpeq(vec_and(offsetSin,toM128(0x2)),_mm_setzero_ps());
357  cosMask = vec_cmpeq(vec_and(offsetCos,toM128(0x2)),_mm_setzero_ps());
358 
359  *s = vec_sel((vec_float4)vec_xor(toM128(0x80000000),(vec_uint4)*s),*s,sinMask);
360  *c = vec_sel((vec_float4)vec_xor(toM128(0x80000000),(vec_uint4)*c),*c,cosMask);
361 }
362 
363 #include "vecidx_aos.h"
364 #include "floatInVec.h"
365 #include "boolInVec.h"
366 
367 #ifdef _VECTORMATH_DEBUG
368 #include <stdio.h>
369 #endif
370 namespace Vectormath {
371 
372 namespace Aos {
373 
374 //-----------------------------------------------------------------------------
375 // Forward Declarations
376 //
377 
378 class Vector3;
379 class Vector4;
380 class Point3;
381 class Quat;
382 class Matrix3;
383 class Matrix4;
384 class Transform3;
385 
386 // A 3-D vector in array-of-structures format
387 //
388 class Vector3
389 {
390  __m128 mVec128;
391 
393 
395 
396 public:
397  // Default constructor; does no initialization
398  //
400 
401  // Default copy constructor
402  //
404 
405  // Construct a 3-D vector from x, y, and z elements
406  //
407  VECTORMATH_FORCE_INLINE Vector3( float x, float y, float z );
408 
409  // Construct a 3-D vector from x, y, and z elements (scalar data contained in vector data type)
410  //
411  VECTORMATH_FORCE_INLINE Vector3( const floatInVec &x, const floatInVec &y, const floatInVec &z );
412 
413  // Copy elements from a 3-D point into a 3-D vector
414  //
415  explicit VECTORMATH_FORCE_INLINE Vector3( const Point3 &pnt );
416 
417  // Set all elements of a 3-D vector to the same scalar value
418  //
419  explicit VECTORMATH_FORCE_INLINE Vector3( float scalar );
420 
421  // Set all elements of a 3-D vector to the same scalar value (scalar data contained in vector data type)
422  //
423  explicit VECTORMATH_FORCE_INLINE Vector3( const floatInVec &scalar );
424 
425  // Set vector float data in a 3-D vector
426  //
427  explicit VECTORMATH_FORCE_INLINE Vector3( __m128 vf4 );
428 
429  // Get vector float data from a 3-D vector
430  //
431  VECTORMATH_FORCE_INLINE __m128 get128( ) const;
432 
433  // Assign one 3-D vector to another
434  //
436 
437  // Set the x element of a 3-D vector
438  //
439  VECTORMATH_FORCE_INLINE Vector3 & setX( float x );
440 
441  // Set the y element of a 3-D vector
442  //
443  VECTORMATH_FORCE_INLINE Vector3 & setY( float y );
444 
445  // Set the z element of a 3-D vector
446  //
447  VECTORMATH_FORCE_INLINE Vector3 & setZ( float z );
448 
449  // Set the x element of a 3-D vector (scalar data contained in vector data type)
450  //
452 
453  // Set the y element of a 3-D vector (scalar data contained in vector data type)
454  //
456 
457  // Set the z element of a 3-D vector (scalar data contained in vector data type)
458  //
460 
461  // Get the x element of a 3-D vector
462  //
463  VECTORMATH_FORCE_INLINE const floatInVec getX( ) const;
464 
465  // Get the y element of a 3-D vector
466  //
467  VECTORMATH_FORCE_INLINE const floatInVec getY( ) const;
468 
469  // Get the z element of a 3-D vector
470  //
471  VECTORMATH_FORCE_INLINE const floatInVec getZ( ) const;
472 
473  // Set an x, y, or z element of a 3-D vector by index
474  //
475  VECTORMATH_FORCE_INLINE Vector3 & setElem( int idx, float value );
476 
477  // Set an x, y, or z element of a 3-D vector by index (scalar data contained in vector data type)
478  //
479  VECTORMATH_FORCE_INLINE Vector3 & setElem( int idx, const floatInVec &value );
480 
481  // Get an x, y, or z element of a 3-D vector by index
482  //
483  VECTORMATH_FORCE_INLINE const floatInVec getElem( int idx ) const;
484 
485  // Subscripting operator to set or get an element
486  //
487  VECTORMATH_FORCE_INLINE VecIdx operator []( int idx );
488 
489  // Subscripting operator to get an element
490  //
491  VECTORMATH_FORCE_INLINE const floatInVec operator []( int idx ) const;
492 
493  // Add two 3-D vectors
494  //
495  VECTORMATH_FORCE_INLINE const Vector3 operator +( const Vector3 &vec ) const;
496 
497  // Subtract a 3-D vector from another 3-D vector
498  //
499  VECTORMATH_FORCE_INLINE const Vector3 operator -( const Vector3 &vec ) const;
500 
501  // Add a 3-D vector to a 3-D point
502  //
503  VECTORMATH_FORCE_INLINE const Point3 operator +( const Point3 &pnt ) const;
504 
505  // Multiply a 3-D vector by a scalar
506  //
507  VECTORMATH_FORCE_INLINE const Vector3 operator *( float scalar ) const;
508 
509  // Divide a 3-D vector by a scalar
510  //
511  VECTORMATH_FORCE_INLINE const Vector3 operator /( float scalar ) const;
512 
513  // Multiply a 3-D vector by a scalar (scalar data contained in vector data type)
514  //
515  VECTORMATH_FORCE_INLINE const Vector3 operator *( const floatInVec &scalar ) const;
516 
517  // Divide a 3-D vector by a scalar (scalar data contained in vector data type)
518  //
519  VECTORMATH_FORCE_INLINE const Vector3 operator /( const floatInVec &scalar ) const;
520 
521  // Perform compound assignment and addition with a 3-D vector
522  //
524 
525  // Perform compound assignment and subtraction by a 3-D vector
526  //
528 
529  // Perform compound assignment and multiplication by a scalar
530  //
531  VECTORMATH_FORCE_INLINE Vector3 & operator *=( float scalar );
532 
533  // Perform compound assignment and division by a scalar
534  //
535  VECTORMATH_FORCE_INLINE Vector3 & operator /=( float scalar );
536 
537  // Perform compound assignment and multiplication by a scalar (scalar data contained in vector data type)
538  //
540 
541  // Perform compound assignment and division by a scalar (scalar data contained in vector data type)
542  //
544 
545  // Negate all elements of a 3-D vector
546  //
548 
549  // Construct x axis
550  //
551  static VECTORMATH_FORCE_INLINE const Vector3 xAxis( );
552 
553  // Construct y axis
554  //
555  static VECTORMATH_FORCE_INLINE const Vector3 yAxis( );
556 
557  // Construct z axis
558  //
559  static VECTORMATH_FORCE_INLINE const Vector3 zAxis( );
560 
561 };
562 
563 // Multiply a 3-D vector by a scalar
564 //
565 VECTORMATH_FORCE_INLINE const Vector3 operator *( float scalar, const Vector3 &vec );
566 
567 // Multiply a 3-D vector by a scalar (scalar data contained in vector data type)
568 //
569 VECTORMATH_FORCE_INLINE const Vector3 operator *( const floatInVec &scalar, const Vector3 &vec );
570 
571 // Multiply two 3-D vectors per element
572 //
573 VECTORMATH_FORCE_INLINE const Vector3 mulPerElem( const Vector3 &vec0, const Vector3 &vec1 );
574 
575 // Divide two 3-D vectors per element
576 // NOTE:
577 // Floating-point behavior matches standard library function divf4.
578 //
579 VECTORMATH_FORCE_INLINE const Vector3 divPerElem( const Vector3 &vec0, const Vector3 &vec1 );
580 
581 // Compute the reciprocal of a 3-D vector per element
582 // NOTE:
583 // Floating-point behavior matches standard library function recipf4.
584 //
585 VECTORMATH_FORCE_INLINE const Vector3 recipPerElem( const Vector3 &vec );
586 
587 // Compute the absolute value of a 3-D vector per element
588 //
589 VECTORMATH_FORCE_INLINE const Vector3 absPerElem( const Vector3 &vec );
590 
591 // Copy sign from one 3-D vector to another, per element
592 //
593 VECTORMATH_FORCE_INLINE const Vector3 copySignPerElem( const Vector3 &vec0, const Vector3 &vec1 );
594 
595 // Maximum of two 3-D vectors per element
596 //
597 VECTORMATH_FORCE_INLINE const Vector3 maxPerElem( const Vector3 &vec0, const Vector3 &vec1 );
598 
599 // Minimum of two 3-D vectors per element
600 //
601 VECTORMATH_FORCE_INLINE const Vector3 minPerElem( const Vector3 &vec0, const Vector3 &vec1 );
602 
603 // Maximum element of a 3-D vector
604 //
605 VECTORMATH_FORCE_INLINE const floatInVec maxElem( const Vector3 &vec );
606 
607 // Minimum element of a 3-D vector
608 //
609 VECTORMATH_FORCE_INLINE const floatInVec minElem( const Vector3 &vec );
610 
611 // Compute the sum of all elements of a 3-D vector
612 //
613 VECTORMATH_FORCE_INLINE const floatInVec sum( const Vector3 &vec );
614 
615 // Compute the dot product of two 3-D vectors
616 //
617 VECTORMATH_FORCE_INLINE const floatInVec dot( const Vector3 &vec0, const Vector3 &vec1 );
618 
619 // Compute the square of the length of a 3-D vector
620 //
621 VECTORMATH_FORCE_INLINE const floatInVec lengthSqr( const Vector3 &vec );
622 
623 // Compute the length of a 3-D vector
624 //
625 VECTORMATH_FORCE_INLINE const floatInVec length( const Vector3 &vec );
626 
627 // Normalize a 3-D vector
628 // NOTE:
629 // The result is unpredictable when all elements of vec are at or near zero.
630 //
631 VECTORMATH_FORCE_INLINE const Vector3 normalize( const Vector3 &vec );
632 
633 // Compute cross product of two 3-D vectors
634 //
635 VECTORMATH_FORCE_INLINE const Vector3 cross( const Vector3 &vec0, const Vector3 &vec1 );
636 
637 // Outer product of two 3-D vectors
638 //
639 VECTORMATH_FORCE_INLINE const Matrix3 outer( const Vector3 &vec0, const Vector3 &vec1 );
640 
641 // Pre-multiply a row vector by a 3x3 matrix
642 // NOTE:
643 // Slower than column post-multiply.
644 //
645 VECTORMATH_FORCE_INLINE const Vector3 rowMul( const Vector3 &vec, const Matrix3 & mat );
646 
647 // Cross-product matrix of a 3-D vector
648 //
649 VECTORMATH_FORCE_INLINE const Matrix3 crossMatrix( const Vector3 &vec );
650 
651 // Create cross-product matrix and multiply
652 // NOTE:
653 // Faster than separately creating a cross-product matrix and multiplying.
654 //
655 VECTORMATH_FORCE_INLINE const Matrix3 crossMatrixMul( const Vector3 &vec, const Matrix3 & mat );
656 
657 // Linear interpolation between two 3-D vectors
658 // NOTE:
659 // Does not clamp t between 0 and 1.
660 //
661 VECTORMATH_FORCE_INLINE const Vector3 lerp( float t, const Vector3 &vec0, const Vector3 &vec1 );
662 
663 // Linear interpolation between two 3-D vectors (scalar data contained in vector data type)
664 // NOTE:
665 // Does not clamp t between 0 and 1.
666 //
667 VECTORMATH_FORCE_INLINE const Vector3 lerp( const floatInVec &t, const Vector3 &vec0, const Vector3 &vec1 );
668 
669 // Spherical linear interpolation between two 3-D vectors
670 // NOTE:
671 // The result is unpredictable if the vectors point in opposite directions.
672 // Does not clamp t between 0 and 1.
673 //
674 VECTORMATH_FORCE_INLINE const Vector3 slerp( float t, const Vector3 &unitVec0, const Vector3 &unitVec1 );
675 
676 // Spherical linear interpolation between two 3-D vectors (scalar data contained in vector data type)
677 // NOTE:
678 // The result is unpredictable if the vectors point in opposite directions.
679 // Does not clamp t between 0 and 1.
680 //
681 VECTORMATH_FORCE_INLINE const Vector3 slerp( const floatInVec &t, const Vector3 &unitVec0, const Vector3 &unitVec1 );
682 
683 // Conditionally select between two 3-D vectors
684 // NOTE:
685 // This function uses a conditional select instruction to avoid a branch.
686 // However, the transfer of select1 to a VMX register may use more processing time than a branch.
687 // Use the boolInVec version for better performance.
688 //
689 VECTORMATH_FORCE_INLINE const Vector3 select( const Vector3 &vec0, const Vector3 &vec1, bool select1 );
690 
691 // Conditionally select between two 3-D vectors (scalar data contained in vector data type)
692 // NOTE:
693 // This function uses a conditional select instruction to avoid a branch.
694 //
695 VECTORMATH_FORCE_INLINE const Vector3 select( const Vector3 &vec0, const Vector3 &vec1, const boolInVec &select1 );
696 
697 // Store x, y, and z elements of 3-D vector in first three words of a quadword, preserving fourth word
698 //
699 VECTORMATH_FORCE_INLINE void storeXYZ( const Vector3 &vec, __m128 * quad );
700 
701 // Load four three-float 3-D vectors, stored in three quadwords
702 //
703 VECTORMATH_FORCE_INLINE void loadXYZArray( Vector3 & vec0, Vector3 & vec1, Vector3 & vec2, Vector3 & vec3, const __m128 * threeQuads );
704 
705 // Store four 3-D vectors in three quadwords
706 //
707 VECTORMATH_FORCE_INLINE void storeXYZArray( const Vector3 &vec0, const Vector3 &vec1, const Vector3 &vec2, const Vector3 &vec3, __m128 * threeQuads );
708 
709 // Store eight 3-D vectors as half-floats
710 //
711 VECTORMATH_FORCE_INLINE void storeHalfFloats( const Vector3 &vec0, const Vector3 &vec1, const Vector3 &vec2, const Vector3 &vec3, const Vector3 &vec4, const Vector3 &vec5, const Vector3 &vec6, const Vector3 &vec7, vec_ushort8 * threeQuads );
712 
713 #ifdef _VECTORMATH_DEBUG
714 
715 // Print a 3-D vector
716 // NOTE:
717 // Function is only defined when _VECTORMATH_DEBUG is defined.
718 //
719 VECTORMATH_FORCE_INLINE void print( const Vector3 &vec );
720 
721 // Print a 3-D vector and an associated string identifier
722 // NOTE:
723 // Function is only defined when _VECTORMATH_DEBUG is defined.
724 //
725 VECTORMATH_FORCE_INLINE void print( const Vector3 &vec, const char * name );
726 
727 #endif
728 
729 // A 4-D vector in array-of-structures format
730 //
731 class Vector4
732 {
733  __m128 mVec128;
734 
735 public:
736  // Default constructor; does no initialization
737  //
739 
740  // Construct a 4-D vector from x, y, z, and w elements
741  //
742  VECTORMATH_FORCE_INLINE Vector4( float x, float y, float z, float w );
743 
744  // Construct a 4-D vector from x, y, z, and w elements (scalar data contained in vector data type)
745  //
746  VECTORMATH_FORCE_INLINE Vector4( const floatInVec &x, const floatInVec &y, const floatInVec &z, const floatInVec &w );
747 
748  // Construct a 4-D vector from a 3-D vector and a scalar
749  //
750  VECTORMATH_FORCE_INLINE Vector4( const Vector3 &xyz, float w );
751 
752  // Construct a 4-D vector from a 3-D vector and a scalar (scalar data contained in vector data type)
753  //
754  VECTORMATH_FORCE_INLINE Vector4( const Vector3 &xyz, const floatInVec &w );
755 
756  // Copy x, y, and z from a 3-D vector into a 4-D vector, and set w to 0
757  //
758  explicit VECTORMATH_FORCE_INLINE Vector4( const Vector3 &vec );
759 
760  // Copy x, y, and z from a 3-D point into a 4-D vector, and set w to 1
761  //
762  explicit VECTORMATH_FORCE_INLINE Vector4( const Point3 &pnt );
763 
764  // Copy elements from a quaternion into a 4-D vector
765  //
766  explicit VECTORMATH_FORCE_INLINE Vector4( const Quat &quat );
767 
768  // Set all elements of a 4-D vector to the same scalar value
769  //
770  explicit VECTORMATH_FORCE_INLINE Vector4( float scalar );
771 
772  // Set all elements of a 4-D vector to the same scalar value (scalar data contained in vector data type)
773  //
774  explicit VECTORMATH_FORCE_INLINE Vector4( const floatInVec &scalar );
775 
776  // Set vector float data in a 4-D vector
777  //
778  explicit VECTORMATH_FORCE_INLINE Vector4( __m128 vf4 );
779 
780  // Get vector float data from a 4-D vector
781  //
782  VECTORMATH_FORCE_INLINE __m128 get128( ) const;
783 
784  // Assign one 4-D vector to another
785  //
787 
788  // Set the x, y, and z elements of a 4-D vector
789  // NOTE:
790  // This function does not change the w element.
791  //
793 
794  // Get the x, y, and z elements of a 4-D vector
795  //
796  VECTORMATH_FORCE_INLINE const Vector3 getXYZ( ) const;
797 
798  // Set the x element of a 4-D vector
799  //
800  VECTORMATH_FORCE_INLINE Vector4 & setX( float x );
801 
802  // Set the y element of a 4-D vector
803  //
804  VECTORMATH_FORCE_INLINE Vector4 & setY( float y );
805 
806  // Set the z element of a 4-D vector
807  //
808  VECTORMATH_FORCE_INLINE Vector4 & setZ( float z );
809 
810  // Set the w element of a 4-D vector
811  //
812  VECTORMATH_FORCE_INLINE Vector4 & setW( float w );
813 
814  // Set the x element of a 4-D vector (scalar data contained in vector data type)
815  //
817 
818  // Set the y element of a 4-D vector (scalar data contained in vector data type)
819  //
821 
822  // Set the z element of a 4-D vector (scalar data contained in vector data type)
823  //
825 
826  // Set the w element of a 4-D vector (scalar data contained in vector data type)
827  //
829 
830  // Get the x element of a 4-D vector
831  //
832  VECTORMATH_FORCE_INLINE const floatInVec getX( ) const;
833 
834  // Get the y element of a 4-D vector
835  //
836  VECTORMATH_FORCE_INLINE const floatInVec getY( ) const;
837 
838  // Get the z element of a 4-D vector
839  //
840  VECTORMATH_FORCE_INLINE const floatInVec getZ( ) const;
841 
842  // Get the w element of a 4-D vector
843  //
844  VECTORMATH_FORCE_INLINE const floatInVec getW( ) const;
845 
846  // Set an x, y, z, or w element of a 4-D vector by index
847  //
848  VECTORMATH_FORCE_INLINE Vector4 & setElem( int idx, float value );
849 
850  // Set an x, y, z, or w element of a 4-D vector by index (scalar data contained in vector data type)
851  //
852  VECTORMATH_FORCE_INLINE Vector4 & setElem( int idx, const floatInVec &value );
853 
854  // Get an x, y, z, or w element of a 4-D vector by index
855  //
856  VECTORMATH_FORCE_INLINE const floatInVec getElem( int idx ) const;
857 
858  // Subscripting operator to set or get an element
859  //
860  VECTORMATH_FORCE_INLINE VecIdx operator []( int idx );
861 
862  // Subscripting operator to get an element
863  //
864  VECTORMATH_FORCE_INLINE const floatInVec operator []( int idx ) const;
865 
866  // Add two 4-D vectors
867  //
868  VECTORMATH_FORCE_INLINE const Vector4 operator +( const Vector4 &vec ) const;
869 
870  // Subtract a 4-D vector from another 4-D vector
871  //
872  VECTORMATH_FORCE_INLINE const Vector4 operator -( const Vector4 &vec ) const;
873 
874  // Multiply a 4-D vector by a scalar
875  //
876  VECTORMATH_FORCE_INLINE const Vector4 operator *( float scalar ) const;
877 
878  // Divide a 4-D vector by a scalar
879  //
880  VECTORMATH_FORCE_INLINE const Vector4 operator /( float scalar ) const;
881 
882  // Multiply a 4-D vector by a scalar (scalar data contained in vector data type)
883  //
884  VECTORMATH_FORCE_INLINE const Vector4 operator *( const floatInVec &scalar ) const;
885 
886  // Divide a 4-D vector by a scalar (scalar data contained in vector data type)
887  //
888  VECTORMATH_FORCE_INLINE const Vector4 operator /( const floatInVec &scalar ) const;
889 
890  // Perform compound assignment and addition with a 4-D vector
891  //
893 
894  // Perform compound assignment and subtraction by a 4-D vector
895  //
897 
898  // Perform compound assignment and multiplication by a scalar
899  //
900  VECTORMATH_FORCE_INLINE Vector4 & operator *=( float scalar );
901 
902  // Perform compound assignment and division by a scalar
903  //
904  VECTORMATH_FORCE_INLINE Vector4 & operator /=( float scalar );
905 
906  // Perform compound assignment and multiplication by a scalar (scalar data contained in vector data type)
907  //
909 
910  // Perform compound assignment and division by a scalar (scalar data contained in vector data type)
911  //
913 
914  // Negate all elements of a 4-D vector
915  //
917 
918  // Construct x axis
919  //
920  static VECTORMATH_FORCE_INLINE const Vector4 xAxis( );
921 
922  // Construct y axis
923  //
924  static VECTORMATH_FORCE_INLINE const Vector4 yAxis( );
925 
926  // Construct z axis
927  //
928  static VECTORMATH_FORCE_INLINE const Vector4 zAxis( );
929 
930  // Construct w axis
931  //
932  static VECTORMATH_FORCE_INLINE const Vector4 wAxis( );
933 
934 };
935 
936 // Multiply a 4-D vector by a scalar
937 //
938 VECTORMATH_FORCE_INLINE const Vector4 operator *( float scalar, const Vector4 &vec );
939 
940 // Multiply a 4-D vector by a scalar (scalar data contained in vector data type)
941 //
942 VECTORMATH_FORCE_INLINE const Vector4 operator *( const floatInVec &scalar, const Vector4 &vec );
943 
944 // Multiply two 4-D vectors per element
945 //
946 VECTORMATH_FORCE_INLINE const Vector4 mulPerElem( const Vector4 &vec0, const Vector4 &vec1 );
947 
948 // Divide two 4-D vectors per element
949 // NOTE:
950 // Floating-point behavior matches standard library function divf4.
951 //
952 VECTORMATH_FORCE_INLINE const Vector4 divPerElem( const Vector4 &vec0, const Vector4 &vec1 );
953 
954 // Compute the reciprocal of a 4-D vector per element
955 // NOTE:
956 // Floating-point behavior matches standard library function recipf4.
957 //
958 VECTORMATH_FORCE_INLINE const Vector4 recipPerElem( const Vector4 &vec );
959 
960 // Compute the absolute value of a 4-D vector per element
961 //
962 VECTORMATH_FORCE_INLINE const Vector4 absPerElem( const Vector4 &vec );
963 
964 // Copy sign from one 4-D vector to another, per element
965 //
966 VECTORMATH_FORCE_INLINE const Vector4 copySignPerElem( const Vector4 &vec0, const Vector4 &vec1 );
967 
968 // Maximum of two 4-D vectors per element
969 //
970 VECTORMATH_FORCE_INLINE const Vector4 maxPerElem( const Vector4 &vec0, const Vector4 &vec1 );
971 
972 // Minimum of two 4-D vectors per element
973 //
974 VECTORMATH_FORCE_INLINE const Vector4 minPerElem( const Vector4 &vec0, const Vector4 &vec1 );
975 
976 // Maximum element of a 4-D vector
977 //
978 VECTORMATH_FORCE_INLINE const floatInVec maxElem( const Vector4 &vec );
979 
980 // Minimum element of a 4-D vector
981 //
982 VECTORMATH_FORCE_INLINE const floatInVec minElem( const Vector4 &vec );
983 
984 // Compute the sum of all elements of a 4-D vector
985 //
986 VECTORMATH_FORCE_INLINE const floatInVec sum( const Vector4 &vec );
987 
988 // Compute the dot product of two 4-D vectors
989 //
990 VECTORMATH_FORCE_INLINE const floatInVec dot( const Vector4 &vec0, const Vector4 &vec1 );
991 
992 // Compute the square of the length of a 4-D vector
993 //
994 VECTORMATH_FORCE_INLINE const floatInVec lengthSqr( const Vector4 &vec );
995 
996 // Compute the length of a 4-D vector
997 //
998 VECTORMATH_FORCE_INLINE const floatInVec length( const Vector4 &vec );
999 
1000 // Normalize a 4-D vector
1001 // NOTE:
1002 // The result is unpredictable when all elements of vec are at or near zero.
1003 //
1004 VECTORMATH_FORCE_INLINE const Vector4 normalize( const Vector4 &vec );
1005 
1006 // Outer product of two 4-D vectors
1007 //
1008 VECTORMATH_FORCE_INLINE const Matrix4 outer( const Vector4 &vec0, const Vector4 &vec1 );
1009 
1010 // Linear interpolation between two 4-D vectors
1011 // NOTE:
1012 // Does not clamp t between 0 and 1.
1013 //
1014 VECTORMATH_FORCE_INLINE const Vector4 lerp( float t, const Vector4 &vec0, const Vector4 &vec1 );
1015 
1016 // Linear interpolation between two 4-D vectors (scalar data contained in vector data type)
1017 // NOTE:
1018 // Does not clamp t between 0 and 1.
1019 //
1020 VECTORMATH_FORCE_INLINE const Vector4 lerp( const floatInVec &t, const Vector4 &vec0, const Vector4 &vec1 );
1021 
1022 // Spherical linear interpolation between two 4-D vectors
1023 // NOTE:
1024 // The result is unpredictable if the vectors point in opposite directions.
1025 // Does not clamp t between 0 and 1.
1026 //
1027 VECTORMATH_FORCE_INLINE const Vector4 slerp( float t, const Vector4 &unitVec0, const Vector4 &unitVec1 );
1028 
1029 // Spherical linear interpolation between two 4-D vectors (scalar data contained in vector data type)
1030 // NOTE:
1031 // The result is unpredictable if the vectors point in opposite directions.
1032 // Does not clamp t between 0 and 1.
1033 //
1034 VECTORMATH_FORCE_INLINE const Vector4 slerp( const floatInVec &t, const Vector4 &unitVec0, const Vector4 &unitVec1 );
1035 
1036 // Conditionally select between two 4-D vectors
1037 // NOTE:
1038 // This function uses a conditional select instruction to avoid a branch.
1039 // However, the transfer of select1 to a VMX register may use more processing time than a branch.
1040 // Use the boolInVec version for better performance.
1041 //
1042 VECTORMATH_FORCE_INLINE const Vector4 select( const Vector4 &vec0, const Vector4 &vec1, bool select1 );
1043 
1044 // Conditionally select between two 4-D vectors (scalar data contained in vector data type)
1045 // NOTE:
1046 // This function uses a conditional select instruction to avoid a branch.
1047 //
1048 VECTORMATH_FORCE_INLINE const Vector4 select( const Vector4 &vec0, const Vector4 &vec1, const boolInVec &select1 );
1049 
1050 // Store four 4-D vectors as half-floats
1051 //
1052 VECTORMATH_FORCE_INLINE void storeHalfFloats( const Vector4 &vec0, const Vector4 &vec1, const Vector4 &vec2, const Vector4 &vec3, vec_ushort8 * twoQuads );
1053 
1054 #ifdef _VECTORMATH_DEBUG
1055 
1056 // Print a 4-D vector
1057 // NOTE:
1058 // Function is only defined when _VECTORMATH_DEBUG is defined.
1059 //
1060 VECTORMATH_FORCE_INLINE void print( const Vector4 &vec );
1061 
1062 // Print a 4-D vector and an associated string identifier
1063 // NOTE:
1064 // Function is only defined when _VECTORMATH_DEBUG is defined.
1065 //
1066 VECTORMATH_FORCE_INLINE void print( const Vector4 &vec, const char * name );
1067 
1068 #endif
1069 
1070 // A 3-D point in array-of-structures format
1071 //
1072 class Point3
1073 {
1074  __m128 mVec128;
1075 
1076 public:
1077  // Default constructor; does no initialization
1078  //
1080 
1081  // Construct a 3-D point from x, y, and z elements
1082  //
1083  VECTORMATH_FORCE_INLINE Point3( float x, float y, float z );
1084 
1085  // Construct a 3-D point from x, y, and z elements (scalar data contained in vector data type)
1086  //
1087  VECTORMATH_FORCE_INLINE Point3( const floatInVec &x, const floatInVec &y, const floatInVec &z );
1088 
1089  // Copy elements from a 3-D vector into a 3-D point
1090  //
1091  explicit VECTORMATH_FORCE_INLINE Point3( const Vector3 &vec );
1092 
1093  // Set all elements of a 3-D point to the same scalar value
1094  //
1095  explicit VECTORMATH_FORCE_INLINE Point3( float scalar );
1096 
1097  // Set all elements of a 3-D point to the same scalar value (scalar data contained in vector data type)
1098  //
1099  explicit VECTORMATH_FORCE_INLINE Point3( const floatInVec &scalar );
1100 
1101  // Set vector float data in a 3-D point
1102  //
1103  explicit VECTORMATH_FORCE_INLINE Point3( __m128 vf4 );
1104 
1105  // Get vector float data from a 3-D point
1106  //
1107  VECTORMATH_FORCE_INLINE __m128 get128( ) const;
1108 
1109  // Assign one 3-D point to another
1110  //
1112 
1113  // Set the x element of a 3-D point
1114  //
1115  VECTORMATH_FORCE_INLINE Point3 & setX( float x );
1116 
1117  // Set the y element of a 3-D point
1118  //
1119  VECTORMATH_FORCE_INLINE Point3 & setY( float y );
1120 
1121  // Set the z element of a 3-D point
1122  //
1123  VECTORMATH_FORCE_INLINE Point3 & setZ( float z );
1124 
1125  // Set the x element of a 3-D point (scalar data contained in vector data type)
1126  //
1128 
1129  // Set the y element of a 3-D point (scalar data contained in vector data type)
1130  //
1132 
1133  // Set the z element of a 3-D point (scalar data contained in vector data type)
1134  //
1136 
1137  // Get the x element of a 3-D point
1138  //
1139  VECTORMATH_FORCE_INLINE const floatInVec getX( ) const;
1140 
1141  // Get the y element of a 3-D point
1142  //
1143  VECTORMATH_FORCE_INLINE const floatInVec getY( ) const;
1144 
1145  // Get the z element of a 3-D point
1146  //
1147  VECTORMATH_FORCE_INLINE const floatInVec getZ( ) const;
1148 
1149  // Set an x, y, or z element of a 3-D point by index
1150  //
1151  VECTORMATH_FORCE_INLINE Point3 & setElem( int idx, float value );
1152 
1153  // Set an x, y, or z element of a 3-D point by index (scalar data contained in vector data type)
1154  //
1155  VECTORMATH_FORCE_INLINE Point3 & setElem( int idx, const floatInVec &value );
1156 
1157  // Get an x, y, or z element of a 3-D point by index
1158  //
1159  VECTORMATH_FORCE_INLINE const floatInVec getElem( int idx ) const;
1160 
1161  // Subscripting operator to set or get an element
1162  //
1163  VECTORMATH_FORCE_INLINE VecIdx operator []( int idx );
1164 
1165  // Subscripting operator to get an element
1166  //
1167  VECTORMATH_FORCE_INLINE const floatInVec operator []( int idx ) const;
1168 
1169  // Subtract a 3-D point from another 3-D point
1170  //
1171  VECTORMATH_FORCE_INLINE const Vector3 operator -( const Point3 &pnt ) const;
1172 
1173  // Add a 3-D point to a 3-D vector
1174  //
1175  VECTORMATH_FORCE_INLINE const Point3 operator +( const Vector3 &vec ) const;
1176 
1177  // Subtract a 3-D vector from a 3-D point
1178  //
1179  VECTORMATH_FORCE_INLINE const Point3 operator -( const Vector3 &vec ) const;
1180 
1181  // Perform compound assignment and addition with a 3-D vector
1182  //
1184 
1185  // Perform compound assignment and subtraction by a 3-D vector
1186  //
1188 
1189 };
1190 
1191 // Multiply two 3-D points per element
1192 //
1193 VECTORMATH_FORCE_INLINE const Point3 mulPerElem( const Point3 &pnt0, const Point3 &pnt1 );
1194 
1195 // Divide two 3-D points per element
1196 // NOTE:
1197 // Floating-point behavior matches standard library function divf4.
1198 //
1199 VECTORMATH_FORCE_INLINE const Point3 divPerElem( const Point3 &pnt0, const Point3 &pnt1 );
1200 
1201 // Compute the reciprocal of a 3-D point per element
1202 // NOTE:
1203 // Floating-point behavior matches standard library function recipf4.
1204 //
1205 VECTORMATH_FORCE_INLINE const Point3 recipPerElem( const Point3 &pnt );
1206 
1207 // Compute the absolute value of a 3-D point per element
1208 //
1209 VECTORMATH_FORCE_INLINE const Point3 absPerElem( const Point3 &pnt );
1210 
1211 // Copy sign from one 3-D point to another, per element
1212 //
1213 VECTORMATH_FORCE_INLINE const Point3 copySignPerElem( const Point3 &pnt0, const Point3 &pnt1 );
1214 
1215 // Maximum of two 3-D points per element
1216 //
1217 VECTORMATH_FORCE_INLINE const Point3 maxPerElem( const Point3 &pnt0, const Point3 &pnt1 );
1218 
1219 // Minimum of two 3-D points per element
1220 //
1221 VECTORMATH_FORCE_INLINE const Point3 minPerElem( const Point3 &pnt0, const Point3 &pnt1 );
1222 
1223 // Maximum element of a 3-D point
1224 //
1225 VECTORMATH_FORCE_INLINE const floatInVec maxElem( const Point3 &pnt );
1226 
1227 // Minimum element of a 3-D point
1228 //
1229 VECTORMATH_FORCE_INLINE const floatInVec minElem( const Point3 &pnt );
1230 
1231 // Compute the sum of all elements of a 3-D point
1232 //
1233 VECTORMATH_FORCE_INLINE const floatInVec sum( const Point3 &pnt );
1234 
1235 // Apply uniform scale to a 3-D point
1236 //
1237 VECTORMATH_FORCE_INLINE const Point3 scale( const Point3 &pnt, float scaleVal );
1238 
1239 // Apply uniform scale to a 3-D point (scalar data contained in vector data type)
1240 //
1241 VECTORMATH_FORCE_INLINE const Point3 scale( const Point3 &pnt, const floatInVec &scaleVal );
1242 
1243 // Apply non-uniform scale to a 3-D point
1244 //
1245 VECTORMATH_FORCE_INLINE const Point3 scale( const Point3 &pnt, const Vector3 &scaleVec );
1246 
1247 // Scalar projection of a 3-D point on a unit-length 3-D vector
1248 //
1249 VECTORMATH_FORCE_INLINE const floatInVec projection( const Point3 &pnt, const Vector3 &unitVec );
1250 
1251 // Compute the square of the distance of a 3-D point from the coordinate-system origin
1252 //
1253 VECTORMATH_FORCE_INLINE const floatInVec distSqrFromOrigin( const Point3 &pnt );
1254 
1255 // Compute the distance of a 3-D point from the coordinate-system origin
1256 //
1257 VECTORMATH_FORCE_INLINE const floatInVec distFromOrigin( const Point3 &pnt );
1258 
1259 // Compute the square of the distance between two 3-D points
1260 //
1261 VECTORMATH_FORCE_INLINE const floatInVec distSqr( const Point3 &pnt0, const Point3 &pnt1 );
1262 
1263 // Compute the distance between two 3-D points
1264 //
1265 VECTORMATH_FORCE_INLINE const floatInVec dist( const Point3 &pnt0, const Point3 &pnt1 );
1266 
1267 // Linear interpolation between two 3-D points
1268 // NOTE:
1269 // Does not clamp t between 0 and 1.
1270 //
1271 VECTORMATH_FORCE_INLINE const Point3 lerp( float t, const Point3 &pnt0, const Point3 &pnt1 );
1272 
1273 // Linear interpolation between two 3-D points (scalar data contained in vector data type)
1274 // NOTE:
1275 // Does not clamp t between 0 and 1.
1276 //
1277 VECTORMATH_FORCE_INLINE const Point3 lerp( const floatInVec &t, const Point3 &pnt0, const Point3 &pnt1 );
1278 
1279 // Conditionally select between two 3-D points
1280 // NOTE:
1281 // This function uses a conditional select instruction to avoid a branch.
1282 // However, the transfer of select1 to a VMX register may use more processing time than a branch.
1283 // Use the boolInVec version for better performance.
1284 //
1285 VECTORMATH_FORCE_INLINE const Point3 select( const Point3 &pnt0, const Point3 &pnt1, bool select1 );
1286 
1287 // Conditionally select between two 3-D points (scalar data contained in vector data type)
1288 // NOTE:
1289 // This function uses a conditional select instruction to avoid a branch.
1290 //
1291 VECTORMATH_FORCE_INLINE const Point3 select( const Point3 &pnt0, const Point3 &pnt1, const boolInVec &select1 );
1292 
1293 // Store x, y, and z elements of 3-D point in first three words of a quadword, preserving fourth word
1294 //
1295 VECTORMATH_FORCE_INLINE void storeXYZ( const Point3 &pnt, __m128 * quad );
1296 
1297 // Load four three-float 3-D points, stored in three quadwords
1298 //
1299 VECTORMATH_FORCE_INLINE void loadXYZArray( Point3 & pnt0, Point3 & pnt1, Point3 & pnt2, Point3 & pnt3, const __m128 * threeQuads );
1300 
1301 // Store four 3-D points in three quadwords
1302 //
1303 VECTORMATH_FORCE_INLINE void storeXYZArray( const Point3 &pnt0, const Point3 &pnt1, const Point3 &pnt2, const Point3 &pnt3, __m128 * threeQuads );
1304 
1305 // Store eight 3-D points as half-floats
1306 //
1307 VECTORMATH_FORCE_INLINE void storeHalfFloats( const Point3 &pnt0, const Point3 &pnt1, const Point3 &pnt2, const Point3 &pnt3, const Point3 &pnt4, const Point3 &pnt5, const Point3 &pnt6, const Point3 &pnt7, vec_ushort8 * threeQuads );
1308 
1309 #ifdef _VECTORMATH_DEBUG
1310 
1311 // Print a 3-D point
1312 // NOTE:
1313 // Function is only defined when _VECTORMATH_DEBUG is defined.
1314 //
1315 VECTORMATH_FORCE_INLINE void print( const Point3 &pnt );
1316 
1317 // Print a 3-D point and an associated string identifier
1318 // NOTE:
1319 // Function is only defined when _VECTORMATH_DEBUG is defined.
1320 //
1321 VECTORMATH_FORCE_INLINE void print( const Point3 &pnt, const char * name );
1322 
1323 #endif
1324 
1325 // A quaternion in array-of-structures format
1326 //
1327 class Quat
1328 {
1329  __m128 mVec128;
1330 
1331 public:
1332  // Default constructor; does no initialization
1333  //
1335 
1336  VECTORMATH_FORCE_INLINE Quat(const Quat& quat);
1337 
1338  // Construct a quaternion from x, y, z, and w elements
1339  //
1340  VECTORMATH_FORCE_INLINE Quat( float x, float y, float z, float w );
1341 
1342  // Construct a quaternion from x, y, z, and w elements (scalar data contained in vector data type)
1343  //
1344  VECTORMATH_FORCE_INLINE Quat( const floatInVec &x, const floatInVec &y, const floatInVec &z, const floatInVec &w );
1345 
1346  // Construct a quaternion from a 3-D vector and a scalar
1347  //
1348  VECTORMATH_FORCE_INLINE Quat( const Vector3 &xyz, float w );
1349 
1350  // Construct a quaternion from a 3-D vector and a scalar (scalar data contained in vector data type)
1351  //
1352  VECTORMATH_FORCE_INLINE Quat( const Vector3 &xyz, const floatInVec &w );
1353 
1354  // Copy elements from a 4-D vector into a quaternion
1355  //
1356  explicit VECTORMATH_FORCE_INLINE Quat( const Vector4 &vec );
1357 
1358  // Convert a rotation matrix to a unit-length quaternion
1359  //
1360  explicit VECTORMATH_FORCE_INLINE Quat( const Matrix3 & rotMat );
1361 
1362  // Set all elements of a quaternion to the same scalar value
1363  //
1364  explicit VECTORMATH_FORCE_INLINE Quat( float scalar );
1365 
1366  // Set all elements of a quaternion to the same scalar value (scalar data contained in vector data type)
1367  //
1368  explicit VECTORMATH_FORCE_INLINE Quat( const floatInVec &scalar );
1369 
1370  // Set vector float data in a quaternion
1371  //
1372  explicit VECTORMATH_FORCE_INLINE Quat( __m128 vf4 );
1373 
1374  // Get vector float data from a quaternion
1375  //
1376  VECTORMATH_FORCE_INLINE __m128 get128( ) const;
1377 
1378  // Set a quaterion from vector float data
1379  //
1381 
1382  // Assign one quaternion to another
1383  //
1384  VECTORMATH_FORCE_INLINE Quat & operator =( const Quat &quat );
1385 
1386  // Set the x, y, and z elements of a quaternion
1387  // NOTE:
1388  // This function does not change the w element.
1389  //
1390  VECTORMATH_FORCE_INLINE Quat & setXYZ( const Vector3 &vec );
1391 
1392  // Get the x, y, and z elements of a quaternion
1393  //
1394  VECTORMATH_FORCE_INLINE const Vector3 getXYZ( ) const;
1395 
1396  // Set the x element of a quaternion
1397  //
1398  VECTORMATH_FORCE_INLINE Quat & setX( float x );
1399 
1400  // Set the y element of a quaternion
1401  //
1402  VECTORMATH_FORCE_INLINE Quat & setY( float y );
1403 
1404  // Set the z element of a quaternion
1405  //
1406  VECTORMATH_FORCE_INLINE Quat & setZ( float z );
1407 
1408  // Set the w element of a quaternion
1409  //
1410  VECTORMATH_FORCE_INLINE Quat & setW( float w );
1411 
1412  // Set the x element of a quaternion (scalar data contained in vector data type)
1413  //
1415 
1416  // Set the y element of a quaternion (scalar data contained in vector data type)
1417  //
1419 
1420  // Set the z element of a quaternion (scalar data contained in vector data type)
1421  //
1423 
1424  // Set the w element of a quaternion (scalar data contained in vector data type)
1425  //
1427 
1428  // Get the x element of a quaternion
1429  //
1430  VECTORMATH_FORCE_INLINE const floatInVec getX( ) const;
1431 
1432  // Get the y element of a quaternion
1433  //
1434  VECTORMATH_FORCE_INLINE const floatInVec getY( ) const;
1435 
1436  // Get the z element of a quaternion
1437  //
1438  VECTORMATH_FORCE_INLINE const floatInVec getZ( ) const;
1439 
1440  // Get the w element of a quaternion
1441  //
1442  VECTORMATH_FORCE_INLINE const floatInVec getW( ) const;
1443 
1444  // Set an x, y, z, or w element of a quaternion by index
1445  //
1446  VECTORMATH_FORCE_INLINE Quat & setElem( int idx, float value );
1447 
1448  // Set an x, y, z, or w element of a quaternion by index (scalar data contained in vector data type)
1449  //
1450  VECTORMATH_FORCE_INLINE Quat & setElem( int idx, const floatInVec &value );
1451 
1452  // Get an x, y, z, or w element of a quaternion by index
1453  //
1454  VECTORMATH_FORCE_INLINE const floatInVec getElem( int idx ) const;
1455 
1456  // Subscripting operator to set or get an element
1457  //
1458  VECTORMATH_FORCE_INLINE VecIdx operator []( int idx );
1459 
1460  // Subscripting operator to get an element
1461  //
1462  VECTORMATH_FORCE_INLINE const floatInVec operator []( int idx ) const;
1463 
1464  // Add two quaternions
1465  //
1466  VECTORMATH_FORCE_INLINE const Quat operator +( const Quat &quat ) const;
1467 
1468  // Subtract a quaternion from another quaternion
1469  //
1470  VECTORMATH_FORCE_INLINE const Quat operator -( const Quat &quat ) const;
1471 
1472  // Multiply two quaternions
1473  //
1474  VECTORMATH_FORCE_INLINE const Quat operator *( const Quat &quat ) const;
1475 
1476  // Multiply a quaternion by a scalar
1477  //
1478  VECTORMATH_FORCE_INLINE const Quat operator *( float scalar ) const;
1479 
1480  // Divide a quaternion by a scalar
1481  //
1482  VECTORMATH_FORCE_INLINE const Quat operator /( float scalar ) const;
1483 
1484  // Multiply a quaternion by a scalar (scalar data contained in vector data type)
1485  //
1486  VECTORMATH_FORCE_INLINE const Quat operator *( const floatInVec &scalar ) const;
1487 
1488  // Divide a quaternion by a scalar (scalar data contained in vector data type)
1489  //
1490  VECTORMATH_FORCE_INLINE const Quat operator /( const floatInVec &scalar ) const;
1491 
1492  // Perform compound assignment and addition with a quaternion
1493  //
1494  VECTORMATH_FORCE_INLINE Quat & operator +=( const Quat &quat );
1495 
1496  // Perform compound assignment and subtraction by a quaternion
1497  //
1498  VECTORMATH_FORCE_INLINE Quat & operator -=( const Quat &quat );
1499 
1500  // Perform compound assignment and multiplication by a quaternion
1501  //
1502  VECTORMATH_FORCE_INLINE Quat & operator *=( const Quat &quat );
1503 
1504  // Perform compound assignment and multiplication by a scalar
1505  //
1506  VECTORMATH_FORCE_INLINE Quat & operator *=( float scalar );
1507 
1508  // Perform compound assignment and division by a scalar
1509  //
1510  VECTORMATH_FORCE_INLINE Quat & operator /=( float scalar );
1511 
1512  // Perform compound assignment and multiplication by a scalar (scalar data contained in vector data type)
1513  //
1515 
1516  // Perform compound assignment and division by a scalar (scalar data contained in vector data type)
1517  //
1519 
1520  // Negate all elements of a quaternion
1521  //
1522  VECTORMATH_FORCE_INLINE const Quat operator -( ) const;
1523 
1524  // Construct an identity quaternion
1525  //
1526  static VECTORMATH_FORCE_INLINE const Quat identity( );
1527 
1528  // Construct a quaternion to rotate between two unit-length 3-D vectors
1529  // NOTE:
1530  // The result is unpredictable if unitVec0 and unitVec1 point in opposite directions.
1531  //
1532  static VECTORMATH_FORCE_INLINE const Quat rotation( const Vector3 &unitVec0, const Vector3 &unitVec1 );
1533 
1534  // Construct a quaternion to rotate around a unit-length 3-D vector
1535  //
1536  static VECTORMATH_FORCE_INLINE const Quat rotation( float radians, const Vector3 &unitVec );
1537 
1538  // Construct a quaternion to rotate around a unit-length 3-D vector (scalar data contained in vector data type)
1539  //
1540  static VECTORMATH_FORCE_INLINE const Quat rotation( const floatInVec &radians, const Vector3 &unitVec );
1541 
1542  // Construct a quaternion to rotate around the x axis
1543  //
1544  static VECTORMATH_FORCE_INLINE const Quat rotationX( float radians );
1545 
1546  // Construct a quaternion to rotate around the y axis
1547  //
1548  static VECTORMATH_FORCE_INLINE const Quat rotationY( float radians );
1549 
1550  // Construct a quaternion to rotate around the z axis
1551  //
1552  static VECTORMATH_FORCE_INLINE const Quat rotationZ( float radians );
1553 
1554  // Construct a quaternion to rotate around the x axis (scalar data contained in vector data type)
1555  //
1556  static VECTORMATH_FORCE_INLINE const Quat rotationX( const floatInVec &radians );
1557 
1558  // Construct a quaternion to rotate around the y axis (scalar data contained in vector data type)
1559  //
1560  static VECTORMATH_FORCE_INLINE const Quat rotationY( const floatInVec &radians );
1561 
1562  // Construct a quaternion to rotate around the z axis (scalar data contained in vector data type)
1563  //
1564  static VECTORMATH_FORCE_INLINE const Quat rotationZ( const floatInVec &radians );
1565 
1566 };
1567 
1568 // Multiply a quaternion by a scalar
1569 //
1570 VECTORMATH_FORCE_INLINE const Quat operator *( float scalar, const Quat &quat );
1571 
1572 // Multiply a quaternion by a scalar (scalar data contained in vector data type)
1573 //
1574 VECTORMATH_FORCE_INLINE const Quat operator *( const floatInVec &scalar, const Quat &quat );
1575 
1576 // Compute the conjugate of a quaternion
1577 //
1578 VECTORMATH_FORCE_INLINE const Quat conj( const Quat &quat );
1579 
1580 // Use a unit-length quaternion to rotate a 3-D vector
1581 //
1582 VECTORMATH_FORCE_INLINE const Vector3 rotate( const Quat &unitQuat, const Vector3 &vec );
1583 
1584 // Compute the dot product of two quaternions
1585 //
1586 VECTORMATH_FORCE_INLINE const floatInVec dot( const Quat &quat0, const Quat &quat1 );
1587 
1588 // Compute the norm of a quaternion
1589 //
1590 VECTORMATH_FORCE_INLINE const floatInVec norm( const Quat &quat );
1591 
1592 // Compute the length of a quaternion
1593 //
1594 VECTORMATH_FORCE_INLINE const floatInVec length( const Quat &quat );
1595 
1596 // Normalize a quaternion
1597 // NOTE:
1598 // The result is unpredictable when all elements of quat are at or near zero.
1599 //
1600 VECTORMATH_FORCE_INLINE const Quat normalize( const Quat &quat );
1601 
1602 // Linear interpolation between two quaternions
1603 // NOTE:
1604 // Does not clamp t between 0 and 1.
1605 //
1606 VECTORMATH_FORCE_INLINE const Quat lerp( float t, const Quat &quat0, const Quat &quat1 );
1607 
1608 // Linear interpolation between two quaternions (scalar data contained in vector data type)
1609 // NOTE:
1610 // Does not clamp t between 0 and 1.
1611 //
1612 VECTORMATH_FORCE_INLINE const Quat lerp( const floatInVec &t, const Quat &quat0, const Quat &quat1 );
1613 
1614 // Spherical linear interpolation between two quaternions
1615 // NOTE:
1616 // Interpolates along the shortest path between orientations.
1617 // Does not clamp t between 0 and 1.
1618 //
1619 VECTORMATH_FORCE_INLINE const Quat slerp( float t, const Quat &unitQuat0, const Quat &unitQuat1 );
1620 
1621 // Spherical linear interpolation between two quaternions (scalar data contained in vector data type)
1622 // NOTE:
1623 // Interpolates along the shortest path between orientations.
1624 // Does not clamp t between 0 and 1.
1625 //
1626 VECTORMATH_FORCE_INLINE const Quat slerp( const floatInVec &t, const Quat &unitQuat0, const Quat &unitQuat1 );
1627 
1628 // Spherical quadrangle interpolation
1629 //
1630 VECTORMATH_FORCE_INLINE const Quat squad( float t, const Quat &unitQuat0, const Quat &unitQuat1, const Quat &unitQuat2, const Quat &unitQuat3 );
1631 
1632 // Spherical quadrangle interpolation (scalar data contained in vector data type)
1633 //
1634 VECTORMATH_FORCE_INLINE const Quat squad( const floatInVec &t, const Quat &unitQuat0, const Quat &unitQuat1, const Quat &unitQuat2, const Quat &unitQuat3 );
1635 
1636 // Conditionally select between two quaternions
1637 // NOTE:
1638 // This function uses a conditional select instruction to avoid a branch.
1639 // However, the transfer of select1 to a VMX register may use more processing time than a branch.
1640 // Use the boolInVec version for better performance.
1641 //
1642 VECTORMATH_FORCE_INLINE const Quat select( const Quat &quat0, const Quat &quat1, bool select1 );
1643 
1644 // Conditionally select between two quaternions (scalar data contained in vector data type)
1645 // NOTE:
1646 // This function uses a conditional select instruction to avoid a branch.
1647 //
1648 VECTORMATH_FORCE_INLINE const Quat select( const Quat &quat0, const Quat &quat1, const boolInVec &select1 );
1649 
1650 #ifdef _VECTORMATH_DEBUG
1651 
1652 // Print a quaternion
1653 // NOTE:
1654 // Function is only defined when _VECTORMATH_DEBUG is defined.
1655 //
1656 VECTORMATH_FORCE_INLINE void print( const Quat &quat );
1657 
1658 // Print a quaternion and an associated string identifier
1659 // NOTE:
1660 // Function is only defined when _VECTORMATH_DEBUG is defined.
1661 //
1662 VECTORMATH_FORCE_INLINE void print( const Quat &quat, const char * name );
1663 
1664 #endif
1665 
1666 // A 3x3 matrix in array-of-structures format
1667 //
1668 class Matrix3
1669 {
1670  Vector3 mCol0;
1671  Vector3 mCol1;
1672  Vector3 mCol2;
1673 
1674 public:
1675  // Default constructor; does no initialization
1676  //
1678 
1679  // Copy a 3x3 matrix
1680  //
1681  VECTORMATH_FORCE_INLINE Matrix3( const Matrix3 & mat );
1682 
1683  // Construct a 3x3 matrix containing the specified columns
1684  //
1685  VECTORMATH_FORCE_INLINE Matrix3( const Vector3 &col0, const Vector3 &col1, const Vector3 &col2 );
1686 
1687  // Construct a 3x3 rotation matrix from a unit-length quaternion
1688  //
1689  explicit VECTORMATH_FORCE_INLINE Matrix3( const Quat &unitQuat );
1690 
1691  // Set all elements of a 3x3 matrix to the same scalar value
1692  //
1693  explicit VECTORMATH_FORCE_INLINE Matrix3( float scalar );
1694 
1695  // Set all elements of a 3x3 matrix to the same scalar value (scalar data contained in vector data type)
1696  //
1697  explicit VECTORMATH_FORCE_INLINE Matrix3( const floatInVec &scalar );
1698 
1699  // Assign one 3x3 matrix to another
1700  //
1702 
1703  // Set column 0 of a 3x3 matrix
1704  //
1706 
1707  // Set column 1 of a 3x3 matrix
1708  //
1710 
1711  // Set column 2 of a 3x3 matrix
1712  //
1714 
1715  // Get column 0 of a 3x3 matrix
1716  //
1717  VECTORMATH_FORCE_INLINE const Vector3 getCol0( ) const;
1718 
1719  // Get column 1 of a 3x3 matrix
1720  //
1721  VECTORMATH_FORCE_INLINE const Vector3 getCol1( ) const;
1722 
1723  // Get column 2 of a 3x3 matrix
1724  //
1725  VECTORMATH_FORCE_INLINE const Vector3 getCol2( ) const;
1726 
1727  // Set the column of a 3x3 matrix referred to by the specified index
1728  //
1729  VECTORMATH_FORCE_INLINE Matrix3 & setCol( int col, const Vector3 &vec );
1730 
1731  // Set the row of a 3x3 matrix referred to by the specified index
1732  //
1733  VECTORMATH_FORCE_INLINE Matrix3 & setRow( int row, const Vector3 &vec );
1734 
1735  // Get the column of a 3x3 matrix referred to by the specified index
1736  //
1737  VECTORMATH_FORCE_INLINE const Vector3 getCol( int col ) const;
1738 
1739  // Get the row of a 3x3 matrix referred to by the specified index
1740  //
1741  VECTORMATH_FORCE_INLINE const Vector3 getRow( int row ) const;
1742 
1743  // Subscripting operator to set or get a column
1744  //
1746 
1747  // Subscripting operator to get a column
1748  //
1749  VECTORMATH_FORCE_INLINE const Vector3 operator []( int col ) const;
1750 
1751  // Set the element of a 3x3 matrix referred to by column and row indices
1752  //
1753  VECTORMATH_FORCE_INLINE Matrix3 & setElem( int col, int row, float val );
1754 
1755  // Set the element of a 3x3 matrix referred to by column and row indices (scalar data contained in vector data type)
1756  //
1757  VECTORMATH_FORCE_INLINE Matrix3 & setElem( int col, int row, const floatInVec &val );
1758 
1759  // Get the element of a 3x3 matrix referred to by column and row indices
1760  //
1761  VECTORMATH_FORCE_INLINE const floatInVec getElem( int col, int row ) const;
1762 
1763  // Add two 3x3 matrices
1764  //
1765  VECTORMATH_FORCE_INLINE const Matrix3 operator +( const Matrix3 & mat ) const;
1766 
1767  // Subtract a 3x3 matrix from another 3x3 matrix
1768  //
1769  VECTORMATH_FORCE_INLINE const Matrix3 operator -( const Matrix3 & mat ) const;
1770 
1771  // Negate all elements of a 3x3 matrix
1772  //
1774 
1775  // Multiply a 3x3 matrix by a scalar
1776  //
1777  VECTORMATH_FORCE_INLINE const Matrix3 operator *( float scalar ) const;
1778 
1779  // Multiply a 3x3 matrix by a scalar (scalar data contained in vector data type)
1780  //
1781  VECTORMATH_FORCE_INLINE const Matrix3 operator *( const floatInVec &scalar ) const;
1782 
1783  // Multiply a 3x3 matrix by a 3-D vector
1784  //
1785  VECTORMATH_FORCE_INLINE const Vector3 operator *( const Vector3 &vec ) const;
1786 
1787  // Multiply two 3x3 matrices
1788  //
1789  VECTORMATH_FORCE_INLINE const Matrix3 operator *( const Matrix3 & mat ) const;
1790 
1791  // Perform compound assignment and addition with a 3x3 matrix
1792  //
1794 
1795  // Perform compound assignment and subtraction by a 3x3 matrix
1796  //
1798 
1799  // Perform compound assignment and multiplication by a scalar
1800  //
1801  VECTORMATH_FORCE_INLINE Matrix3 & operator *=( float scalar );
1802 
1803  // Perform compound assignment and multiplication by a scalar (scalar data contained in vector data type)
1804  //
1806 
1807  // Perform compound assignment and multiplication by a 3x3 matrix
1808  //
1810 
1811  // Construct an identity 3x3 matrix
1812  //
1813  static VECTORMATH_FORCE_INLINE const Matrix3 identity( );
1814 
1815  // Construct a 3x3 matrix to rotate around the x axis
1816  //
1817  static VECTORMATH_FORCE_INLINE const Matrix3 rotationX( float radians );
1818 
1819  // Construct a 3x3 matrix to rotate around the y axis
1820  //
1821  static VECTORMATH_FORCE_INLINE const Matrix3 rotationY( float radians );
1822 
1823  // Construct a 3x3 matrix to rotate around the z axis
1824  //
1825  static VECTORMATH_FORCE_INLINE const Matrix3 rotationZ( float radians );
1826 
1827  // Construct a 3x3 matrix to rotate around the x axis (scalar data contained in vector data type)
1828  //
1829  static VECTORMATH_FORCE_INLINE const Matrix3 rotationX( const floatInVec &radians );
1830 
1831  // Construct a 3x3 matrix to rotate around the y axis (scalar data contained in vector data type)
1832  //
1833  static VECTORMATH_FORCE_INLINE const Matrix3 rotationY( const floatInVec &radians );
1834 
1835  // Construct a 3x3 matrix to rotate around the z axis (scalar data contained in vector data type)
1836  //
1837  static VECTORMATH_FORCE_INLINE const Matrix3 rotationZ( const floatInVec &radians );
1838 
1839  // Construct a 3x3 matrix to rotate around the x, y, and z axes
1840  //
1841  static VECTORMATH_FORCE_INLINE const Matrix3 rotationZYX( const Vector3 &radiansXYZ );
1842 
1843  // Construct a 3x3 matrix to rotate around a unit-length 3-D vector
1844  //
1845  static VECTORMATH_FORCE_INLINE const Matrix3 rotation( float radians, const Vector3 &unitVec );
1846 
1847  // Construct a 3x3 matrix to rotate around a unit-length 3-D vector (scalar data contained in vector data type)
1848  //
1849  static VECTORMATH_FORCE_INLINE const Matrix3 rotation( const floatInVec &radians, const Vector3 &unitVec );
1850 
1851  // Construct a rotation matrix from a unit-length quaternion
1852  //
1853  static VECTORMATH_FORCE_INLINE const Matrix3 rotation( const Quat &unitQuat );
1854 
1855  // Construct a 3x3 matrix to perform scaling
1856  //
1857  static VECTORMATH_FORCE_INLINE const Matrix3 scale( const Vector3 &scaleVec );
1858 
1859 };
1860 // Multiply a 3x3 matrix by a scalar
1861 //
1862 VECTORMATH_FORCE_INLINE const Matrix3 operator *( float scalar, const Matrix3 & mat );
1863 
1864 // Multiply a 3x3 matrix by a scalar (scalar data contained in vector data type)
1865 //
1866 VECTORMATH_FORCE_INLINE const Matrix3 operator *( const floatInVec &scalar, const Matrix3 & mat );
1867 
1868 // Append (post-multiply) a scale transformation to a 3x3 matrix
1869 // NOTE:
1870 // Faster than creating and multiplying a scale transformation matrix.
1871 //
1872 VECTORMATH_FORCE_INLINE const Matrix3 appendScale( const Matrix3 & mat, const Vector3 &scaleVec );
1873 
1874 // Prepend (pre-multiply) a scale transformation to a 3x3 matrix
1875 // NOTE:
1876 // Faster than creating and multiplying a scale transformation matrix.
1877 //
1878 VECTORMATH_FORCE_INLINE const Matrix3 prependScale( const Vector3 &scaleVec, const Matrix3 & mat );
1879 
1880 // Multiply two 3x3 matrices per element
1881 //
1882 VECTORMATH_FORCE_INLINE const Matrix3 mulPerElem( const Matrix3 & mat0, const Matrix3 & mat1 );
1883 
1884 // Compute the absolute value of a 3x3 matrix per element
1885 //
1886 VECTORMATH_FORCE_INLINE const Matrix3 absPerElem( const Matrix3 & mat );
1887 
1888 // Transpose of a 3x3 matrix
1889 //
1890 VECTORMATH_FORCE_INLINE const Matrix3 transpose( const Matrix3 & mat );
1891 
1892 // Compute the inverse of a 3x3 matrix
1893 // NOTE:
1894 // Result is unpredictable when the determinant of mat is equal to or near 0.
1895 //
1896 VECTORMATH_FORCE_INLINE const Matrix3 inverse( const Matrix3 & mat );
1897 
1898 // Determinant of a 3x3 matrix
1899 //
1900 VECTORMATH_FORCE_INLINE const floatInVec determinant( const Matrix3 & mat );
1901 
1902 // Conditionally select between two 3x3 matrices
1903 // NOTE:
1904 // This function uses a conditional select instruction to avoid a branch.
1905 // However, the transfer of select1 to a VMX register may use more processing time than a branch.
1906 // Use the boolInVec version for better performance.
1907 //
1908 VECTORMATH_FORCE_INLINE const Matrix3 select( const Matrix3 & mat0, const Matrix3 & mat1, bool select1 );
1909 
1910 // Conditionally select between two 3x3 matrices (scalar data contained in vector data type)
1911 // NOTE:
1912 // This function uses a conditional select instruction to avoid a branch.
1913 //
1914 VECTORMATH_FORCE_INLINE const Matrix3 select( const Matrix3 & mat0, const Matrix3 & mat1, const boolInVec &select1 );
1915 
1916 #ifdef _VECTORMATH_DEBUG
1917 
1918 // Print a 3x3 matrix
1919 // NOTE:
1920 // Function is only defined when _VECTORMATH_DEBUG is defined.
1921 //
1922 VECTORMATH_FORCE_INLINE void print( const Matrix3 & mat );
1923 
1924 // Print a 3x3 matrix and an associated string identifier
1925 // NOTE:
1926 // Function is only defined when _VECTORMATH_DEBUG is defined.
1927 //
1928 VECTORMATH_FORCE_INLINE void print( const Matrix3 & mat, const char * name );
1929 
1930 #endif
1931 
1932 // A 4x4 matrix in array-of-structures format
1933 //
1934 class Matrix4
1935 {
1936  Vector4 mCol0;
1937  Vector4 mCol1;
1938  Vector4 mCol2;
1939  Vector4 mCol3;
1940 
1941 public:
1942  // Default constructor; does no initialization
1943  //
1945 
1946  // Copy a 4x4 matrix
1947  //
1948  VECTORMATH_FORCE_INLINE Matrix4( const Matrix4 & mat );
1949 
1950  // Construct a 4x4 matrix containing the specified columns
1951  //
1952  VECTORMATH_FORCE_INLINE Matrix4( const Vector4 &col0, const Vector4 &col1, const Vector4 &col2, const Vector4 &col3 );
1953 
1954  // Construct a 4x4 matrix from a 3x4 transformation matrix
1955  //
1956  explicit VECTORMATH_FORCE_INLINE Matrix4( const Transform3 & mat );
1957 
1958  // Construct a 4x4 matrix from a 3x3 matrix and a 3-D vector
1959  //
1960  VECTORMATH_FORCE_INLINE Matrix4( const Matrix3 & mat, const Vector3 &translateVec );
1961 
1962  // Construct a 4x4 matrix from a unit-length quaternion and a 3-D vector
1963  //
1964  VECTORMATH_FORCE_INLINE Matrix4( const Quat &unitQuat, const Vector3 &translateVec );
1965 
1966  // Set all elements of a 4x4 matrix to the same scalar value
1967  //
1968  explicit VECTORMATH_FORCE_INLINE Matrix4( float scalar );
1969 
1970  // Set all elements of a 4x4 matrix to the same scalar value (scalar data contained in vector data type)
1971  //
1972  explicit VECTORMATH_FORCE_INLINE Matrix4( const floatInVec &scalar );
1973 
1974  // Assign one 4x4 matrix to another
1975  //
1977 
1978  // Set the upper-left 3x3 submatrix
1979  // NOTE:
1980  // This function does not change the bottom row elements.
1981  //
1983 
1984  // Get the upper-left 3x3 submatrix of a 4x4 matrix
1985  //
1987 
1988  // Set translation component
1989  // NOTE:
1990  // This function does not change the bottom row elements.
1991  //
1992  VECTORMATH_FORCE_INLINE Matrix4 & setTranslation( const Vector3 &translateVec );
1993 
1994  // Get the translation component of a 4x4 matrix
1995  //
1997 
1998  // Set column 0 of a 4x4 matrix
1999  //
2001 
2002  // Set column 1 of a 4x4 matrix
2003  //
2005 
2006  // Set column 2 of a 4x4 matrix
2007  //
2009 
2010  // Set column 3 of a 4x4 matrix
2011  //
2013 
2014  // Get column 0 of a 4x4 matrix
2015  //
2016  VECTORMATH_FORCE_INLINE const Vector4 getCol0( ) const;
2017 
2018  // Get column 1 of a 4x4 matrix
2019  //
2020  VECTORMATH_FORCE_INLINE const Vector4 getCol1( ) const;
2021 
2022  // Get column 2 of a 4x4 matrix
2023  //
2024  VECTORMATH_FORCE_INLINE const Vector4 getCol2( ) const;
2025 
2026  // Get column 3 of a 4x4 matrix
2027  //
2028  VECTORMATH_FORCE_INLINE const Vector4 getCol3( ) const;
2029 
2030  // Set the column of a 4x4 matrix referred to by the specified index
2031  //
2032  VECTORMATH_FORCE_INLINE Matrix4 & setCol( int col, const Vector4 &vec );
2033 
2034  // Set the row of a 4x4 matrix referred to by the specified index
2035  //
2036  VECTORMATH_FORCE_INLINE Matrix4 & setRow( int row, const Vector4 &vec );
2037 
2038  // Get the column of a 4x4 matrix referred to by the specified index
2039  //
2040  VECTORMATH_FORCE_INLINE const Vector4 getCol( int col ) const;
2041 
2042  // Get the row of a 4x4 matrix referred to by the specified index
2043  //
2044  VECTORMATH_FORCE_INLINE const Vector4 getRow( int row ) const;
2045 
2046  // Subscripting operator to set or get a column
2047  //
2049 
2050  // Subscripting operator to get a column
2051  //
2052  VECTORMATH_FORCE_INLINE const Vector4 operator []( int col ) const;
2053 
2054  // Set the element of a 4x4 matrix referred to by column and row indices
2055  //
2056  VECTORMATH_FORCE_INLINE Matrix4 & setElem( int col, int row, float val );
2057 
2058  // Set the element of a 4x4 matrix referred to by column and row indices (scalar data contained in vector data type)
2059  //
2060  VECTORMATH_FORCE_INLINE Matrix4 & setElem( int col, int row, const floatInVec &val );
2061 
2062  // Get the element of a 4x4 matrix referred to by column and row indices
2063  //
2064  VECTORMATH_FORCE_INLINE const floatInVec getElem( int col, int row ) const;
2065 
2066  // Add two 4x4 matrices
2067  //
2068  VECTORMATH_FORCE_INLINE const Matrix4 operator +( const Matrix4 & mat ) const;
2069 
2070  // Subtract a 4x4 matrix from another 4x4 matrix
2071  //
2072  VECTORMATH_FORCE_INLINE const Matrix4 operator -( const Matrix4 & mat ) const;
2073 
2074  // Negate all elements of a 4x4 matrix
2075  //
2077 
2078  // Multiply a 4x4 matrix by a scalar
2079  //
2080  VECTORMATH_FORCE_INLINE const Matrix4 operator *( float scalar ) const;
2081 
2082  // Multiply a 4x4 matrix by a scalar (scalar data contained in vector data type)
2083  //
2084  VECTORMATH_FORCE_INLINE const Matrix4 operator *( const floatInVec &scalar ) const;
2085 
2086  // Multiply a 4x4 matrix by a 4-D vector
2087  //
2088  VECTORMATH_FORCE_INLINE const Vector4 operator *( const Vector4 &vec ) const;
2089 
2090  // Multiply a 4x4 matrix by a 3-D vector
2091  //
2092  VECTORMATH_FORCE_INLINE const Vector4 operator *( const Vector3 &vec ) const;
2093 
2094  // Multiply a 4x4 matrix by a 3-D point
2095  //
2096  VECTORMATH_FORCE_INLINE const Vector4 operator *( const Point3 &pnt ) const;
2097 
2098  // Multiply two 4x4 matrices
2099  //
2100  VECTORMATH_FORCE_INLINE const Matrix4 operator *( const Matrix4 & mat ) const;
2101 
2102  // Multiply a 4x4 matrix by a 3x4 transformation matrix
2103  //
2104  VECTORMATH_FORCE_INLINE const Matrix4 operator *( const Transform3 & tfrm ) const;
2105 
2106  // Perform compound assignment and addition with a 4x4 matrix
2107  //
2109 
2110  // Perform compound assignment and subtraction by a 4x4 matrix
2111  //
2113 
2114  // Perform compound assignment and multiplication by a scalar
2115  //
2116  VECTORMATH_FORCE_INLINE Matrix4 & operator *=( float scalar );
2117 
2118  // Perform compound assignment and multiplication by a scalar (scalar data contained in vector data type)
2119  //
2121 
2122  // Perform compound assignment and multiplication by a 4x4 matrix
2123  //
2125 
2126  // Perform compound assignment and multiplication by a 3x4 transformation matrix
2127  //
2129 
2130  // Construct an identity 4x4 matrix
2131  //
2132  static VECTORMATH_FORCE_INLINE const Matrix4 identity( );
2133 
2134  // Construct a 4x4 matrix to rotate around the x axis
2135  //
2136  static VECTORMATH_FORCE_INLINE const Matrix4 rotationX( float radians );
2137 
2138  // Construct a 4x4 matrix to rotate around the y axis
2139  //
2140  static VECTORMATH_FORCE_INLINE const Matrix4 rotationY( float radians );
2141 
2142  // Construct a 4x4 matrix to rotate around the z axis
2143  //
2144  static VECTORMATH_FORCE_INLINE const Matrix4 rotationZ( float radians );
2145 
2146  // Construct a 4x4 matrix to rotate around the x axis (scalar data contained in vector data type)
2147  //
2148  static VECTORMATH_FORCE_INLINE const Matrix4 rotationX( const floatInVec &radians );
2149 
2150  // Construct a 4x4 matrix to rotate around the y axis (scalar data contained in vector data type)
2151  //
2152  static VECTORMATH_FORCE_INLINE const Matrix4 rotationY( const floatInVec &radians );
2153 
2154  // Construct a 4x4 matrix to rotate around the z axis (scalar data contained in vector data type)
2155  //
2156  static VECTORMATH_FORCE_INLINE const Matrix4 rotationZ( const floatInVec &radians );
2157 
2158  // Construct a 4x4 matrix to rotate around the x, y, and z axes
2159  //
2160  static VECTORMATH_FORCE_INLINE const Matrix4 rotationZYX( const Vector3 &radiansXYZ );
2161 
2162  // Construct a 4x4 matrix to rotate around a unit-length 3-D vector
2163  //
2164  static VECTORMATH_FORCE_INLINE const Matrix4 rotation( float radians, const Vector3 &unitVec );
2165 
2166  // Construct a 4x4 matrix to rotate around a unit-length 3-D vector (scalar data contained in vector data type)
2167  //
2168  static VECTORMATH_FORCE_INLINE const Matrix4 rotation( const floatInVec &radians, const Vector3 &unitVec );
2169 
2170  // Construct a rotation matrix from a unit-length quaternion
2171  //
2172  static VECTORMATH_FORCE_INLINE const Matrix4 rotation( const Quat &unitQuat );
2173 
2174  // Construct a 4x4 matrix to perform scaling
2175  //
2176  static VECTORMATH_FORCE_INLINE const Matrix4 scale( const Vector3 &scaleVec );
2177 
2178  // Construct a 4x4 matrix to perform translation
2179  //
2180  static VECTORMATH_FORCE_INLINE const Matrix4 translation( const Vector3 &translateVec );
2181 
2182  // Construct viewing matrix based on eye, position looked at, and up direction
2183  //
2184  static VECTORMATH_FORCE_INLINE const Matrix4 lookAt( const Point3 &eyePos, const Point3 &lookAtPos, const Vector3 &upVec );
2185 
2186  // Construct a perspective projection matrix
2187  //
2188  static VECTORMATH_FORCE_INLINE const Matrix4 perspective( float fovyRadians, float aspect, float zNear, float zFar );
2189 
2190  // Construct a perspective projection matrix based on frustum
2191  //
2192  static VECTORMATH_FORCE_INLINE const Matrix4 frustum( float left, float right, float bottom, float top, float zNear, float zFar );
2193 
2194  // Construct an orthographic projection matrix
2195  //
2196  static VECTORMATH_FORCE_INLINE const Matrix4 orthographic( float left, float right, float bottom, float top, float zNear, float zFar );
2197 
2198 };
2199 // Multiply a 4x4 matrix by a scalar
2200 //
2201 VECTORMATH_FORCE_INLINE const Matrix4 operator *( float scalar, const Matrix4 & mat );
2202 
2203 // Multiply a 4x4 matrix by a scalar (scalar data contained in vector data type)
2204 //
2205 VECTORMATH_FORCE_INLINE const Matrix4 operator *( const floatInVec &scalar, const Matrix4 & mat );
2206 
2207 // Append (post-multiply) a scale transformation to a 4x4 matrix
2208 // NOTE:
2209 // Faster than creating and multiplying a scale transformation matrix.
2210 //
2211 VECTORMATH_FORCE_INLINE const Matrix4 appendScale( const Matrix4 & mat, const Vector3 &scaleVec );
2212 
2213 // Prepend (pre-multiply) a scale transformation to a 4x4 matrix
2214 // NOTE:
2215 // Faster than creating and multiplying a scale transformation matrix.
2216 //
2217 VECTORMATH_FORCE_INLINE const Matrix4 prependScale( const Vector3 &scaleVec, const Matrix4 & mat );
2218 
2219 // Multiply two 4x4 matrices per element
2220 //
2221 VECTORMATH_FORCE_INLINE const Matrix4 mulPerElem( const Matrix4 & mat0, const Matrix4 & mat1 );
2222 
2223 // Compute the absolute value of a 4x4 matrix per element
2224 //
2225 VECTORMATH_FORCE_INLINE const Matrix4 absPerElem( const Matrix4 & mat );
2226 
2227 // Transpose of a 4x4 matrix
2228 //
2229 VECTORMATH_FORCE_INLINE const Matrix4 transpose( const Matrix4 & mat );
2230 
2231 // Compute the inverse of a 4x4 matrix
2232 // NOTE:
2233 // Result is unpredictable when the determinant of mat is equal to or near 0.
2234 //
2235 VECTORMATH_FORCE_INLINE const Matrix4 inverse( const Matrix4 & mat );
2236 
2237 // Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix
2238 // NOTE:
2239 // This can be used to achieve better performance than a general inverse when the specified 4x4 matrix meets the given restrictions. The result is unpredictable when the determinant of mat is equal to or near 0.
2240 //
2241 VECTORMATH_FORCE_INLINE const Matrix4 affineInverse( const Matrix4 & mat );
2242 
2243 // Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix with an orthogonal upper-left 3x3 submatrix
2244 // NOTE:
2245 // This can be used to achieve better performance than a general inverse when the specified 4x4 matrix meets the given restrictions.
2246 //
2247 VECTORMATH_FORCE_INLINE const Matrix4 orthoInverse( const Matrix4 & mat );
2248 
2249 // Determinant of a 4x4 matrix
2250 //
2251 VECTORMATH_FORCE_INLINE const floatInVec determinant( const Matrix4 & mat );
2252 
2253 // Conditionally select between two 4x4 matrices
2254 // NOTE:
2255 // This function uses a conditional select instruction to avoid a branch.
2256 // However, the transfer of select1 to a VMX register may use more processing time than a branch.
2257 // Use the boolInVec version for better performance.
2258 //
2259 VECTORMATH_FORCE_INLINE const Matrix4 select( const Matrix4 & mat0, const Matrix4 & mat1, bool select1 );
2260 
2261 // Conditionally select between two 4x4 matrices (scalar data contained in vector data type)
2262 // NOTE:
2263 // This function uses a conditional select instruction to avoid a branch.
2264 //
2265 VECTORMATH_FORCE_INLINE const Matrix4 select( const Matrix4 & mat0, const Matrix4 & mat1, const boolInVec &select1 );
2266 
2267 #ifdef _VECTORMATH_DEBUG
2268 
2269 // Print a 4x4 matrix
2270 // NOTE:
2271 // Function is only defined when _VECTORMATH_DEBUG is defined.
2272 //
2273 VECTORMATH_FORCE_INLINE void print( const Matrix4 & mat );
2274 
2275 // Print a 4x4 matrix and an associated string identifier
2276 // NOTE:
2277 // Function is only defined when _VECTORMATH_DEBUG is defined.
2278 //
2279 VECTORMATH_FORCE_INLINE void print( const Matrix4 & mat, const char * name );
2280 
2281 #endif
2282 
2283 // A 3x4 transformation matrix in array-of-structures format
2284 //
2285 class Transform3
2286 {
2287  Vector3 mCol0;
2288  Vector3 mCol1;
2289  Vector3 mCol2;
2290  Vector3 mCol3;
2291 
2292 public:
2293  // Default constructor; does no initialization
2294  //
2296 
2297  // Copy a 3x4 transformation matrix
2298  //
2300 
2301  // Construct a 3x4 transformation matrix containing the specified columns
2302  //
2303  VECTORMATH_FORCE_INLINE Transform3( const Vector3 &col0, const Vector3 &col1, const Vector3 &col2, const Vector3 &col3 );
2304 
2305  // Construct a 3x4 transformation matrix from a 3x3 matrix and a 3-D vector
2306  //
2307  VECTORMATH_FORCE_INLINE Transform3( const Matrix3 & tfrm, const Vector3 &translateVec );
2308 
2309  // Construct a 3x4 transformation matrix from a unit-length quaternion and a 3-D vector
2310  //
2311  VECTORMATH_FORCE_INLINE Transform3( const Quat &unitQuat, const Vector3 &translateVec );
2312 
2313  // Set all elements of a 3x4 transformation matrix to the same scalar value
2314  //
2315  explicit VECTORMATH_FORCE_INLINE Transform3( float scalar );
2316 
2317  // Set all elements of a 3x4 transformation matrix to the same scalar value (scalar data contained in vector data type)
2318  //
2319  explicit VECTORMATH_FORCE_INLINE Transform3( const floatInVec &scalar );
2320 
2321  // Assign one 3x4 transformation matrix to another
2322  //
2324 
2325  // Set the upper-left 3x3 submatrix
2326  //
2328 
2329  // Get the upper-left 3x3 submatrix of a 3x4 transformation matrix
2330  //
2332 
2333  // Set translation component
2334  //
2335  VECTORMATH_FORCE_INLINE Transform3 & setTranslation( const Vector3 &translateVec );
2336 
2337  // Get the translation component of a 3x4 transformation matrix
2338  //
2340 
2341  // Set column 0 of a 3x4 transformation matrix
2342  //
2344 
2345  // Set column 1 of a 3x4 transformation matrix
2346  //
2348 
2349  // Set column 2 of a 3x4 transformation matrix
2350  //
2352 
2353  // Set column 3 of a 3x4 transformation matrix
2354  //
2356 
2357  // Get column 0 of a 3x4 transformation matrix
2358  //
2359  VECTORMATH_FORCE_INLINE const Vector3 getCol0( ) const;
2360 
2361  // Get column 1 of a 3x4 transformation matrix
2362  //
2363  VECTORMATH_FORCE_INLINE const Vector3 getCol1( ) const;
2364 
2365  // Get column 2 of a 3x4 transformation matrix
2366  //
2367  VECTORMATH_FORCE_INLINE const Vector3 getCol2( ) const;
2368 
2369  // Get column 3 of a 3x4 transformation matrix
2370  //
2371  VECTORMATH_FORCE_INLINE const Vector3 getCol3( ) const;
2372 
2373  // Set the column of a 3x4 transformation matrix referred to by the specified index
2374  //
2375  VECTORMATH_FORCE_INLINE Transform3 & setCol( int col, const Vector3 &vec );
2376 
2377  // Set the row of a 3x4 transformation matrix referred to by the specified index
2378  //
2379  VECTORMATH_FORCE_INLINE Transform3 & setRow( int row, const Vector4 &vec );
2380 
2381  // Get the column of a 3x4 transformation matrix referred to by the specified index
2382  //
2383  VECTORMATH_FORCE_INLINE const Vector3 getCol( int col ) const;
2384 
2385  // Get the row of a 3x4 transformation matrix referred to by the specified index
2386  //
2387  VECTORMATH_FORCE_INLINE const Vector4 getRow( int row ) const;
2388 
2389  // Subscripting operator to set or get a column
2390  //
2392 
2393  // Subscripting operator to get a column
2394  //
2395  VECTORMATH_FORCE_INLINE const Vector3 operator []( int col ) const;
2396 
2397  // Set the element of a 3x4 transformation matrix referred to by column and row indices
2398  //
2399  VECTORMATH_FORCE_INLINE Transform3 & setElem( int col, int row, float val );
2400 
2401  // Set the element of a 3x4 transformation matrix referred to by column and row indices (scalar data contained in vector data type)
2402  //
2403  VECTORMATH_FORCE_INLINE Transform3 & setElem( int col, int row, const floatInVec &val );
2404 
2405  // Get the element of a 3x4 transformation matrix referred to by column and row indices
2406  //
2407  VECTORMATH_FORCE_INLINE const floatInVec getElem( int col, int row ) const;
2408 
2409  // Multiply a 3x4 transformation matrix by a 3-D vector
2410  //
2411  VECTORMATH_FORCE_INLINE const Vector3 operator *( const Vector3 &vec ) const;
2412 
2413  // Multiply a 3x4 transformation matrix by a 3-D point
2414  //
2415  VECTORMATH_FORCE_INLINE const Point3 operator *( const Point3 &pnt ) const;
2416 
2417  // Multiply two 3x4 transformation matrices
2418  //
2419  VECTORMATH_FORCE_INLINE const Transform3 operator *( const Transform3 & tfrm ) const;
2420 
2421  // Perform compound assignment and multiplication by a 3x4 transformation matrix
2422  //
2424 
2425  // Construct an identity 3x4 transformation matrix
2426  //
2428 
2429  // Construct a 3x4 transformation matrix to rotate around the x axis
2430  //
2431  static VECTORMATH_FORCE_INLINE const Transform3 rotationX( float radians );
2432 
2433  // Construct a 3x4 transformation matrix to rotate around the y axis
2434  //
2435  static VECTORMATH_FORCE_INLINE const Transform3 rotationY( float radians );
2436 
2437  // Construct a 3x4 transformation matrix to rotate around the z axis
2438  //
2439  static VECTORMATH_FORCE_INLINE const Transform3 rotationZ( float radians );
2440 
2441  // Construct a 3x4 transformation matrix to rotate around the x axis (scalar data contained in vector data type)
2442  //
2443  static VECTORMATH_FORCE_INLINE const Transform3 rotationX( const floatInVec &radians );
2444 
2445  // Construct a 3x4 transformation matrix to rotate around the y axis (scalar data contained in vector data type)
2446  //
2447  static VECTORMATH_FORCE_INLINE const Transform3 rotationY( const floatInVec &radians );
2448 
2449  // Construct a 3x4 transformation matrix to rotate around the z axis (scalar data contained in vector data type)
2450  //
2451  static VECTORMATH_FORCE_INLINE const Transform3 rotationZ( const floatInVec &radians );
2452 
2453  // Construct a 3x4 transformation matrix to rotate around the x, y, and z axes
2454  //
2455  static VECTORMATH_FORCE_INLINE const Transform3 rotationZYX( const Vector3 &radiansXYZ );
2456 
2457  // Construct a 3x4 transformation matrix to rotate around a unit-length 3-D vector
2458  //
2459  static VECTORMATH_FORCE_INLINE const Transform3 rotation( float radians, const Vector3 &unitVec );
2460 
2461  // Construct a 3x4 transformation matrix to rotate around a unit-length 3-D vector (scalar data contained in vector data type)
2462  //
2463  static VECTORMATH_FORCE_INLINE const Transform3 rotation( const floatInVec &radians, const Vector3 &unitVec );
2464 
2465  // Construct a rotation matrix from a unit-length quaternion
2466  //
2467  static VECTORMATH_FORCE_INLINE const Transform3 rotation( const Quat &unitQuat );
2468 
2469  // Construct a 3x4 transformation matrix to perform scaling
2470  //
2471  static VECTORMATH_FORCE_INLINE const Transform3 scale( const Vector3 &scaleVec );
2472 
2473  // Construct a 3x4 transformation matrix to perform translation
2474  //
2475  static VECTORMATH_FORCE_INLINE const Transform3 translation( const Vector3 &translateVec );
2476 
2477 };
2478 // Append (post-multiply) a scale transformation to a 3x4 transformation matrix
2479 // NOTE:
2480 // Faster than creating and multiplying a scale transformation matrix.
2481 //
2482 VECTORMATH_FORCE_INLINE const Transform3 appendScale( const Transform3 & tfrm, const Vector3 &scaleVec );
2483 
2484 // Prepend (pre-multiply) a scale transformation to a 3x4 transformation matrix
2485 // NOTE:
2486 // Faster than creating and multiplying a scale transformation matrix.
2487 //
2488 VECTORMATH_FORCE_INLINE const Transform3 prependScale( const Vector3 &scaleVec, const Transform3 & tfrm );
2489 
2490 // Multiply two 3x4 transformation matrices per element
2491 //
2492 VECTORMATH_FORCE_INLINE const Transform3 mulPerElem( const Transform3 & tfrm0, const Transform3 & tfrm1 );
2493 
2494 // Compute the absolute value of a 3x4 transformation matrix per element
2495 //
2496 VECTORMATH_FORCE_INLINE const Transform3 absPerElem( const Transform3 & tfrm );
2497 
2498 // Inverse of a 3x4 transformation matrix
2499 // NOTE:
2500 // Result is unpredictable when the determinant of the left 3x3 submatrix is equal to or near 0.
2501 //
2502 VECTORMATH_FORCE_INLINE const Transform3 inverse( const Transform3 & tfrm );
2503 
2504 // Compute the inverse of a 3x4 transformation matrix, expected to have an orthogonal upper-left 3x3 submatrix
2505 // NOTE:
2506 // This can be used to achieve better performance than a general inverse when the specified 3x4 transformation matrix meets the given restrictions.
2507 //
2508 VECTORMATH_FORCE_INLINE const Transform3 orthoInverse( const Transform3 & tfrm );
2509 
2510 // Conditionally select between two 3x4 transformation matrices
2511 // NOTE:
2512 // This function uses a conditional select instruction to avoid a branch.
2513 // However, the transfer of select1 to a VMX register may use more processing time than a branch.
2514 // Use the boolInVec version for better performance.
2515 //
2516 VECTORMATH_FORCE_INLINE const Transform3 select( const Transform3 & tfrm0, const Transform3 & tfrm1, bool select1 );
2517 
2518 // Conditionally select between two 3x4 transformation matrices (scalar data contained in vector data type)
2519 // NOTE:
2520 // This function uses a conditional select instruction to avoid a branch.
2521 //
2522 VECTORMATH_FORCE_INLINE const Transform3 select( const Transform3 & tfrm0, const Transform3 & tfrm1, const boolInVec &select1 );
2523 
2524 #ifdef _VECTORMATH_DEBUG
2525 
2526 // Print a 3x4 transformation matrix
2527 // NOTE:
2528 // Function is only defined when _VECTORMATH_DEBUG is defined.
2529 //
2530 VECTORMATH_FORCE_INLINE void print( const Transform3 & tfrm );
2531 
2532 // Print a 3x4 transformation matrix and an associated string identifier
2533 // NOTE:
2534 // Function is only defined when _VECTORMATH_DEBUG is defined.
2535 //
2536 VECTORMATH_FORCE_INLINE void print( const Transform3 & tfrm, const char * name );
2537 
2538 #endif
2539 
2540 } // namespace Aos
2541 } // namespace Vectormath
2542 
2543 #include "vec_aos.h"
2544 #include "quat_aos.h"
2545 #include "mat_aos.h"
2546 
2547 #endif
const Vector4 operator*(float scalar) const
Definition: neon/vec_aos.h:796
const Vector3 getTranslation() const
const Quat normalize(const Quat &quat)
Matrix4 & setCol1(const Vector4 &col1)
Definition: neon/mat_aos.h:491
float determinant(const Matrix3 &mat)
Definition: neon/mat_aos.h:189
float getY() const
static const Quat rotationY(float radians)
float & operator[](int idx)
const Vector3 getCol0() const
const Vector3 rowMul(const Vector3 &vec, const Matrix3 &mat)
static const Matrix4 scale(const Vector3 &scaleVec)
Definition: neon/mat_aos.h:984
const Vector3 getXYZ() const
Definition: neon/vec_aos.h:706
static const Transform3 rotationY(float radians)
const Matrix3 crossMatrixMul(const Vector3 &vec, const Matrix3 &mat)
const Vector3 recipPerElem(const Vector3 &vec)
Definition: neon/vec_aos.h:351
void loadXYZArray(Vector3 &vec0, Vector3 &vec1, Vector3 &vec2, Vector3 &vec3, const __m128 *threeQuads)
Definition: sse/vec_aos.h:387
static const Vector4 yAxis()
Definition: neon/vec_aos.h:564
float minElem(const Vector3 &vec)
Definition: neon/vec_aos.h:422
__m128 vec_float4
Transform3 & setTranslation(const Vector3 &translateVec)
Vector4 & setXYZ(const Vector3 &vec)
Definition: neon/vec_aos.h:698
static const Matrix4 rotationX(float radians)
Definition: neon/mat_aos.h:901
Vector4 & operator+=(const Vector4 &vec)
Definition: neon/vec_aos.h:806
static const Matrix4 translation(const Vector3 &translateVec)
#define _SINCOS_SC1
#define _SINCOS_CC1
#define _SINCOS_SC0
static const Vector3 xAxis()
Definition: neon/vec_aos.h:64
static const Vector3 zAxis()
Definition: neon/vec_aos.h:74
const Matrix4 operator+(const Matrix4 &mat) const
Definition: neon/mat_aos.h:718
void storeHalfFloats(const Vector3 &vec, unsigned short *hfptr)
Definition: neon/vec_aos.h:145
float dist(const Point3 &pnt0, const Point3 &pnt1)
const Vector3 minPerElem(const Vector3 &vec0, const Vector3 &vec1)
Definition: neon/vec_aos.h:413
float getW() const
Quat & operator*=(const Quat &quat)
Quat & operator-=(const Quat &quat)
const Matrix3 operator*(float scalar) const
Definition: neon/mat_aos.h:242
Matrix3 & setElem(int col, int row, float val)
Definition: neon/mat_aos.h:108
#define vec_xor(a, b)
Vector3 & operator[](int col)
static const Transform3 translation(const Vector3 &translateVec)
Point3 & operator=(const Point3 &pnt)
const Quat operator+(const Quat &quat) const
Point3 & setElem(int idx, float value)
static const Vector4 xAxis()
Definition: neon/vec_aos.h:559
#define vec_madd(a, b, c)
static __m128 sinf4(vec_float4 x)
Quat & setW(float w)
const Matrix3 appendScale(const Matrix3 &mat, const Vector3 &scaleVec)
Definition: neon/mat_aos.h:391
Vector3 & operator=(const Vector3 &vec)
Definition: neon/vec_aos.h:188
Matrix3 & setCol0(const Vector3 &col0)
Definition: neon/mat_aos.h:76
Matrix3 & setCol2(const Vector3 &col2)
Definition: neon/mat_aos.h:88
const Vector3 operator*(const Vector3 &vec) const
unsigned int ui[4]
__m128 vec_int4
Matrix3 & operator-=(const Matrix3 &mat)
Definition: neon/mat_aos.h:218
#define vec_mul(a, b)
Point3 & operator-=(const Vector3 &vec)
const Matrix3 inverse(const Matrix3 &mat)
Definition: neon/mat_aos.h:174
Quat & operator=(const Quat &quat)
static const Transform3 rotationX(float radians)
float distFromOrigin(const Point3 &pnt)
static const Matrix4 rotation(float radians, const Vector3 &unitVec)
Definition: neon/mat_aos.h:959
Quat & setX(float x)
static const Matrix4 rotationY(float radians)
Definition: neon/mat_aos.h:914
static const Transform3 identity()
const Vector3 getCol3() const
const Vector4 operator-() const
Definition: neon/vec_aos.h:840
Vector3 & operator/=(float scalar)
Definition: neon/vec_aos.h:313
const Vector3 rotate(const Quat &quat, const Vector3 &vec)
float & operator[](int idx)
static __m128 vec_cts(__m128 x, int a)
const Matrix3 crossMatrix(const Vector3 &vec)
static const Quat identity()
Definition: neon/quat_aos.h:68
float getElem(int col, int row) const
Definition: neon/mat_aos.h:533
Matrix4 & operator-=(const Matrix4 &mat)
Definition: neon/mat_aos.h:744
static const Matrix4 orthographic(float left, float right, float bottom, float top, float zNear, float zFar)
#define VECTORMATH_FORCE_INLINE
static __m128 acosf4(__m128 x)
Vector3 & setY(float y)
Definition: neon/vec_aos.h:207
static const Matrix3 rotationZ(float radians)
Definition: neon/mat_aos.h:328
#define vec_sub(a, b)
#define _SINCOS_SC2
#define _half4
static const Vector3 yAxis()
Definition: neon/vec_aos.h:69
static const Matrix3 rotationZYX(const Vector3 &radiansXYZ)
Definition: neon/mat_aos.h:340
static const Quat rotationZ(float radians)
Vector4 & setW(float w)
Definition: neon/vec_aos.h:744
Transform3 & setElem(int col, int row, float val)
#define _SINCOS_KC2
static const Quat rotation(const Vector3 &unitVec0, const Vector3 &unitVec1)
Vector3 & operator-=(const Vector3 &vec)
Definition: neon/vec_aos.h:292
const Matrix4 operator*(float scalar) const
Definition: neon/mat_aos.h:770
const Vector4 getCol3() const
Definition: neon/mat_aos.h:553
static const Matrix4 identity()
Definition: neon/mat_aos.h:863
Transform3 & operator=(const Transform3 &tfrm)
static const Vector4 wAxis()
Definition: neon/vec_aos.h:574
Transform3 & setCol0(const Vector3 &col0)
static const Matrix3 identity()
Definition: neon/mat_aos.h:295
Transform3 & setCol(int col, const Vector3 &vec)
const Vector4 getCol1() const
Definition: neon/mat_aos.h:543
Matrix4 & setTranslation(const Vector3 &translateVec)
Definition: neon/mat_aos.h:890
static const Transform3 rotation(float radians, const Vector3 &unitVec)
Vector4 & setZ(float z)
Definition: neon/vec_aos.h:733
const Vector3 maxPerElem(const Vector3 &vec0, const Vector3 &vec1)
Definition: neon/vec_aos.h:396
const Vector4 getCol0() const
Definition: neon/mat_aos.h:538
const Matrix4 affineInverse(const Matrix4 &mat)
Definition: neon/mat_aos.h:666
static const Matrix3 scale(const Vector3 &scaleVec)
Definition: neon/mat_aos.h:382
float lengthSqr(const Vector3 &vec)
Definition: neon/vec_aos.h:447
Vector3 & setZ(float z)
Definition: neon/vec_aos.h:218
float distSqrFromOrigin(const Point3 &pnt)
const Point3 operator+(const Vector3 &vec) const
float & operator[](int idx)
Definition: neon/vec_aos.h:766
const Point3 scale(const Point3 &pnt, float scaleVal)
const Vector3 operator-(const Point3 &pnt) const
Transform3 & setCol3(const Vector3 &col3)
float projection(const Point3 &pnt, const Vector3 &unitVec)
const Vector3 getCol1() const
vec_float4 & get128Ref()
#define _SINCOS_CC2
Vector4 & operator[](int col)
Definition: neon/mat_aos.h:568
SSEFloat(__m128i v)
static const Quat rotationX(float radians)
Vector3 & setX(float x)
Definition: neon/vec_aos.h:196
const Vector3 getCol(int col) const
const Vector3 copySignPerElem(const Vector3 &vec0, const Vector3 &vec1)
Definition: neon/vec_aos.h:387
const Vector3 getCol0() const
Definition: neon/mat_aos.h:122
const Matrix3 getUpper3x3() const
Definition: neon/mat_aos.h:881
Matrix4 & setElem(int col, int row, float val)
Definition: neon/mat_aos.h:524
const Vector4 getRow(int row) const
const Matrix3 outer(const Vector3 &tfrm0, const Vector3 &tfrm1)
const Vector3 operator-() const
Definition: neon/vec_aos.h:319
float select(float arg0, float arg1, bool select)
__m128 get128() const
Definition: sse/vec_aos.h:1170
const Matrix4 operator-() const
Definition: neon/mat_aos.h:750
Matrix4 & operator*=(float scalar)
Definition: neon/mat_aos.h:780
const Vector3 operator+(const Vector3 &vec) const
Definition: neon/vec_aos.h:250
void set128(vec_float4 vec)
Definition: sse/quat_aos.h:45
static __m128 toM128(unsigned int x)
const Quat operator*(const Quat &quat) const
static const Matrix4 frustum(float left, float right, float bottom, float top, float zNear, float zFar)
float norm(const Quat &quat)
Vector3 & operator[](int col)
Definition: neon/mat_aos.h:147
const Quat operator/(float scalar) const
Vector3 & setElem(int idx, float value)
Definition: neon/vec_aos.h:229
const Vector3 getTranslation() const
Definition: neon/mat_aos.h:896
const Matrix3 prependScale(const Vector3 &scaleVec, const Matrix3 &mat)
Definition: neon/mat_aos.h:400
const Quat operator-() const
const Vector4 getCol2() const
Definition: neon/mat_aos.h:548
void storeXYZArray(const Vector3 &vec0, const Vector3 &vec1, const Vector3 &vec2, const Vector3 &vec3, __m128 *threeQuads)
Definition: sse/vec_aos.h:396
const Matrix3 operator+(const Matrix3 &mat) const
Definition: neon/mat_aos.h:194
const Vector3 getXYZ() const
Matrix3 & operator+=(const Matrix3 &mat)
Definition: neon/mat_aos.h:212
#define vec_nmsub(a, b, c)
const Vector3 operator/(float scalar) const
Definition: neon/vec_aos.h:304
const Matrix3 operator-() const
Definition: neon/mat_aos.h:224
void set128(vec_float4 vec)
Definition: sse/vec_aos.h:242
const Matrix3 getUpper3x3() const
Matrix3 & setCol1(const Vector3 &col1)
Definition: neon/mat_aos.h:82
__m128 get128() const
Definition: sse/quat_aos.h:158
Point3 & operator+=(const Vector3 &vec)
static const Matrix3 rotationX(float radians)
Definition: neon/mat_aos.h:304
const Matrix4 orthoInverse(const Matrix4 &mat)
Definition: neon/mat_aos.h:676
const Quat conj(const Quat &quat)
const Vector4 operator+(const Vector4 &vec) const
Definition: neon/vec_aos.h:776
float distSqr(const Point3 &pnt0, const Point3 &pnt1)
static __m128 newtonrapson_rsqrt4(const __m128 v)
static const Transform3 scale(const Vector3 &scaleVec)
float getElem(int idx) const
Definition: neon/vec_aos.h:235
Matrix4 & setCol3(const Vector4 &col3)
Definition: neon/mat_aos.h:503
#define _SINCOS_CC0
__m128 vec_uint4
static void sincosf4(vec_float4 x, vec_float4 *s, vec_float4 *c)
#define _SINCOS_KC1
static const Matrix3 rotation(float radians, const Vector3 &unitVec)
Definition: neon/mat_aos.h:358
const Vector4 getCol(int col) const
Definition: neon/mat_aos.h:558
Matrix4 & setCol(int col, const Vector4 &vec)
Definition: neon/mat_aos.h:509
Matrix4 & setUpper3x3(const Matrix3 &mat3)
Definition: neon/mat_aos.h:873
Quat & operator/=(float scalar)
const Quat lerp(float t, const Quat &quat0, const Quat &quat1)
Definition: neon/quat_aos.h:73
#define sqrtf4(x)
Matrix4 & setCol2(const Vector4 &col2)
Definition: neon/mat_aos.h:497
static const Matrix4 lookAt(const Point3 &eyePos, const Point3 &lookAtPos, const Vector3 &upVec)
const Matrix3 select(const Matrix3 &mat0, const Matrix3 &mat1, bool select1)
Definition: neon/mat_aos.h:409
Matrix4 & operator+=(const Matrix4 &mat)
Definition: neon/mat_aos.h:738
Quat & setElem(int idx, float value)
Point3 & setZ(float z)
static const Transform3 rotationZ(float radians)
Vector4 & setX(float x)
Definition: neon/vec_aos.h:711
static const Matrix4 perspective(float fovyRadians, float aspect, float zNear, float zFar)
const Vector4 operator/(float scalar) const
Definition: neon/vec_aos.h:824
Vector3 & operator*=(float scalar)
Definition: neon/vec_aos.h:298
float getElem(int idx) const
Definition: neon/vec_aos.h:761
static const Matrix3 rotationY(float radians)
Definition: neon/mat_aos.h:316
float getZ() const
const Matrix3 transpose(const Matrix3 &mat)
Definition: neon/mat_aos.h:165
Vector3 & operator+=(const Vector3 &vec)
Definition: neon/vec_aos.h:286
Matrix3 & operator*=(float scalar)
Definition: neon/mat_aos.h:251
Transform3 & setCol2(const Vector3 &col2)
float getElem(int idx) const
const Vector3 getRow(int row) const
Definition: neon/mat_aos.h:142
float getElem(int idx) const
Matrix4 & setCol0(const Vector4 &col0)
Definition: neon/mat_aos.h:485
#define vec_cmpeq(a, b)
float maxElem(const Vector3 &vec)
Definition: neon/vec_aos.h:405
void storeXYZ(const Vector3 &vec, float *fptr)
Definition: neon/vec_aos.h:105
float & operator[](int idx)
Definition: neon/vec_aos.h:240
SSEFloat(__m128 v)
Point3 & setX(float x)
unsigned short s[8]
Quat & setY(float y)
Matrix4 & setRow(int row, const Vector4 &vec)
Definition: neon/mat_aos.h:515
Transform3 & setCol1(const Vector3 &col1)
Matrix3 & setCol(int col, const Vector3 &vec)
Definition: neon/mat_aos.h:94
const Quat squad(float t, const Quat &unitQuat0, const Quat &unitQuat1, const Quat &unitQuat2, const Quat &unitQuat3)
float getElem(int col, int row) const
Definition: neon/mat_aos.h:117
const Vector3 getCol(int col) const
Definition: neon/mat_aos.h:137
static const Matrix4 rotationZYX(const Vector3 &radiansXYZ)
Definition: neon/mat_aos.h:940
float sum(const Vector3 &vec)
Definition: neon/vec_aos.h:430
static const Vector4 zAxis()
Definition: neon/vec_aos.h:569
float dot(const Quat &quat0, const Quat &quat1)
Quat & setZ(float z)
static __m128 fabsf4(__m128 x)
static __m128 vec_ctf(__m128 x, int a)
const Vector3 cross(const Vector3 &vec0, const Vector3 &vec1)
Definition: neon/vec_aos.h:473
const Matrix3 mulPerElem(const Matrix3 &mat0, const Matrix3 &mat1)
Definition: neon/mat_aos.h:286
__m128 get128() const
Definition: sse/vec_aos.h:817
__m128i vec_ushort8
static const Transform3 rotationZYX(const Vector3 &radiansXYZ)
__m128 get128() const
Definition: sse/vec_aos.h:327
Vector4 & operator/=(float scalar)
Definition: neon/vec_aos.h:834
Transform3 & setUpper3x3(const Matrix3 &mat3)
#define _three
Vector4 & setY(float y)
Definition: neon/vec_aos.h:722
Quat & setXYZ(const Vector3 &vec)
static const Matrix4 rotationZ(float radians)
Definition: neon/mat_aos.h:927
Matrix3 & operator=(const Matrix3 &mat)
Definition: neon/mat_aos.h:157
const Vector3 getCol2() const
const Vector3 operator*(float scalar) const
Definition: neon/vec_aos.h:277
const Vector4 getRow(int row) const
Definition: neon/mat_aos.h:563
float length(const Quat &quat)
__m128i vec_uchar16
#define vec_and(a, b)
Vector4 & operator*=(float scalar)
Definition: neon/vec_aos.h:818
const Vector3 divPerElem(const Vector3 &vec0, const Vector3 &vec1)
Definition: neon/vec_aos.h:342
Point3 & setY(float y)
float getElem(int col, int row) const
const Vector3 getCol2() const
Definition: neon/mat_aos.h:132
Transform3 & setRow(int row, const Vector4 &vec)
static __m128 vec_sel(__m128 a, __m128 b, __m128 mask)
const Matrix3 absPerElem(const Matrix3 &mat)
Definition: neon/mat_aos.h:233
Vector4 & setElem(int idx, float value)
Definition: neon/vec_aos.h:755
const Matrix3 operator*(float scalar, const Matrix3 &mat)
Definition: neon/mat_aos.h:257
float getX() const
Transform3 & operator*=(const Transform3 &tfrm)
Matrix3 & setRow(int row, const Vector3 &vec)
Definition: neon/mat_aos.h:100
Vector4 & operator=(const Vector4 &vec)
Definition: neon/vec_aos.h:689
Matrix4 & operator=(const Matrix4 &mat)
Definition: neon/mat_aos.h:578
Quat & operator+=(const Quat &quat)
Vector4 & operator-=(const Vector4 &vec)
Definition: neon/vec_aos.h:812
const Vector3 getCol1() const
Definition: neon/mat_aos.h:127
const Quat slerp(float t, const Quat &unitQuat0, const Quat &unitQuat1)
Definition: neon/quat_aos.h:78