Bullet Collision Detection & Physics Library
scalar/vectormath_aos.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Sony Computer Entertainment Inc.
3  All rights reserved.
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 
15 */
16 
17 #ifndef _VECTORMATH_AOS_CPP_H
18 #define _VECTORMATH_AOS_CPP_H
19 
20 #include <math.h>
21 
22 #ifdef _VECTORMATH_DEBUG
23 #include <stdio.h>
24 #endif
25 
26 namespace Vectormath {
27 
28 namespace Aos {
29 
30 //-----------------------------------------------------------------------------
31 // Forward Declarations
32 //
33 
34 class Vector3;
35 class Vector4;
36 class Point3;
37 class Quat;
38 class Matrix3;
39 class Matrix4;
40 class Transform3;
41 
42 // A 3-D vector in array-of-structures format
43 //
44 class Vector3
45 {
46  float mX;
47  float mY;
48  float mZ;
49 #ifndef __GNUC__
50  float d;
51 #endif
52 
53 public:
54  // Default constructor; does no initialization
55  //
56  inline Vector3( ) { };
57 
58  // Copy a 3-D vector
59  //
60  inline Vector3( const Vector3 & vec );
61 
62  // Construct a 3-D vector from x, y, and z elements
63  //
64  inline Vector3( float x, float y, float z );
65 
66  // Copy elements from a 3-D point into a 3-D vector
67  //
68  explicit inline Vector3( const Point3 & pnt );
69 
70  // Set all elements of a 3-D vector to the same scalar value
71  //
72  explicit inline Vector3( float scalar );
73 
74  // Assign one 3-D vector to another
75  //
76  inline Vector3 & operator =( const Vector3 & vec );
77 
78  // Set the x element of a 3-D vector
79  //
80  inline Vector3 & setX( float x );
81 
82  // Set the y element of a 3-D vector
83  //
84  inline Vector3 & setY( float y );
85 
86  // Set the z element of a 3-D vector
87  //
88  inline Vector3 & setZ( float z );
89 
90  // Get the x element of a 3-D vector
91  //
92  inline float getX( ) const;
93 
94  // Get the y element of a 3-D vector
95  //
96  inline float getY( ) const;
97 
98  // Get the z element of a 3-D vector
99  //
100  inline float getZ( ) const;
101 
102  // Set an x, y, or z element of a 3-D vector by index
103  //
104  inline Vector3 & setElem( int idx, float value );
105 
106  // Get an x, y, or z element of a 3-D vector by index
107  //
108  inline float getElem( int idx ) const;
109 
110  // Subscripting operator to set or get an element
111  //
112  inline float & operator []( int idx );
113 
114  // Subscripting operator to get an element
115  //
116  inline float operator []( int idx ) const;
117 
118  // Add two 3-D vectors
119  //
120  inline const Vector3 operator +( const Vector3 & vec ) const;
121 
122  // Subtract a 3-D vector from another 3-D vector
123  //
124  inline const Vector3 operator -( const Vector3 & vec ) const;
125 
126  // Add a 3-D vector to a 3-D point
127  //
128  inline const Point3 operator +( const Point3 & pnt ) const;
129 
130  // Multiply a 3-D vector by a scalar
131  //
132  inline const Vector3 operator *( float scalar ) const;
133 
134  // Divide a 3-D vector by a scalar
135  //
136  inline const Vector3 operator /( float scalar ) const;
137 
138  // Perform compound assignment and addition with a 3-D vector
139  //
140  inline Vector3 & operator +=( const Vector3 & vec );
141 
142  // Perform compound assignment and subtraction by a 3-D vector
143  //
144  inline Vector3 & operator -=( const Vector3 & vec );
145 
146  // Perform compound assignment and multiplication by a scalar
147  //
148  inline Vector3 & operator *=( float scalar );
149 
150  // Perform compound assignment and division by a scalar
151  //
152  inline Vector3 & operator /=( float scalar );
153 
154  // Negate all elements of a 3-D vector
155  //
156  inline const Vector3 operator -( ) const;
157 
158  // Construct x axis
159  //
160  static inline const Vector3 xAxis( );
161 
162  // Construct y axis
163  //
164  static inline const Vector3 yAxis( );
165 
166  // Construct z axis
167  //
168  static inline const Vector3 zAxis( );
169 
170 }
171 #ifdef __GNUC__
172 __attribute__ ((aligned(16)))
173 #endif
174 ;
175 
176 // Multiply a 3-D vector by a scalar
177 //
178 inline const Vector3 operator *( float scalar, const Vector3 & vec );
179 
180 // Multiply two 3-D vectors per element
181 //
182 inline const Vector3 mulPerElem( const Vector3 & vec0, const Vector3 & vec1 );
183 
184 // Divide two 3-D vectors per element
185 // NOTE:
186 // Floating-point behavior matches standard library function divf4.
187 //
188 inline const Vector3 divPerElem( const Vector3 & vec0, const Vector3 & vec1 );
189 
190 // Compute the reciprocal of a 3-D vector per element
191 // NOTE:
192 // Floating-point behavior matches standard library function recipf4.
193 //
194 inline const Vector3 recipPerElem( const Vector3 & vec );
195 
196 // Compute the square root of a 3-D vector per element
197 // NOTE:
198 // Floating-point behavior matches standard library function sqrtf4.
199 //
200 inline const Vector3 sqrtPerElem( const Vector3 & vec );
201 
202 // Compute the reciprocal square root of a 3-D vector per element
203 // NOTE:
204 // Floating-point behavior matches standard library function rsqrtf4.
205 //
206 inline const Vector3 rsqrtPerElem( const Vector3 & vec );
207 
208 // Compute the absolute value of a 3-D vector per element
209 //
210 inline const Vector3 absPerElem( const Vector3 & vec );
211 
212 // Copy sign from one 3-D vector to another, per element
213 //
214 inline const Vector3 copySignPerElem( const Vector3 & vec0, const Vector3 & vec1 );
215 
216 // Maximum of two 3-D vectors per element
217 //
218 inline const Vector3 maxPerElem( const Vector3 & vec0, const Vector3 & vec1 );
219 
220 // Minimum of two 3-D vectors per element
221 //
222 inline const Vector3 minPerElem( const Vector3 & vec0, const Vector3 & vec1 );
223 
224 // Maximum element of a 3-D vector
225 //
226 inline float maxElem( const Vector3 & vec );
227 
228 // Minimum element of a 3-D vector
229 //
230 inline float minElem( const Vector3 & vec );
231 
232 // Compute the sum of all elements of a 3-D vector
233 //
234 inline float sum( const Vector3 & vec );
235 
236 // Compute the dot product of two 3-D vectors
237 //
238 inline float dot( const Vector3 & vec0, const Vector3 & vec1 );
239 
240 // Compute the square of the length of a 3-D vector
241 //
242 inline float lengthSqr( const Vector3 & vec );
243 
244 // Compute the length of a 3-D vector
245 //
246 inline float length( const Vector3 & vec );
247 
248 // Normalize a 3-D vector
249 // NOTE:
250 // The result is unpredictable when all elements of vec are at or near zero.
251 //
252 inline const Vector3 normalize( const Vector3 & vec );
253 
254 // Compute cross product of two 3-D vectors
255 //
256 inline const Vector3 cross( const Vector3 & vec0, const Vector3 & vec1 );
257 
258 // Outer product of two 3-D vectors
259 //
260 inline const Matrix3 outer( const Vector3 & vec0, const Vector3 & vec1 );
261 
262 // Pre-multiply a row vector by a 3x3 matrix
263 //
264 inline const Vector3 rowMul( const Vector3 & vec, const Matrix3 & mat );
265 
266 // Cross-product matrix of a 3-D vector
267 //
268 inline const Matrix3 crossMatrix( const Vector3 & vec );
269 
270 // Create cross-product matrix and multiply
271 // NOTE:
272 // Faster than separately creating a cross-product matrix and multiplying.
273 //
274 inline const Matrix3 crossMatrixMul( const Vector3 & vec, const Matrix3 & mat );
275 
276 // Linear interpolation between two 3-D vectors
277 // NOTE:
278 // Does not clamp t between 0 and 1.
279 //
280 inline const Vector3 lerp( float t, const Vector3 & vec0, const Vector3 & vec1 );
281 
282 // Spherical linear interpolation between two 3-D vectors
283 // NOTE:
284 // The result is unpredictable if the vectors point in opposite directions.
285 // Does not clamp t between 0 and 1.
286 //
287 inline const Vector3 slerp( float t, const Vector3 & unitVec0, const Vector3 & unitVec1 );
288 
289 // Conditionally select between two 3-D vectors
290 //
291 inline const Vector3 select( const Vector3 & vec0, const Vector3 & vec1, bool select1 );
292 
293 // Load x, y, and z elements from the first three words of a float array.
294 //
295 //
296 inline void loadXYZ( Vector3 & vec, const float * fptr );
297 
298 // Store x, y, and z elements of a 3-D vector in the first three words of a float array.
299 // Memory area of previous 16 bytes and next 32 bytes from fptr might be accessed
300 //
301 inline void storeXYZ( const Vector3 & vec, float * fptr );
302 
303 // Load three-half-floats as a 3-D vector
304 // NOTE:
305 // This transformation does not support either denormalized numbers or NaNs.
306 //
307 inline void loadHalfFloats( Vector3 & vec, const unsigned short * hfptr );
308 
309 // Store a 3-D vector as half-floats. Memory area of previous 16 bytes and next 32 bytes from <code><i>hfptr</i></code> might be accessed.
310 // NOTE:
311 // This transformation does not support either denormalized numbers or NaNs. Memory area of previous 16 bytes and next 32 bytes from hfptr might be accessed.
312 //
313 inline void storeHalfFloats( const Vector3 & vec, unsigned short * hfptr );
314 
315 #ifdef _VECTORMATH_DEBUG
316 
317 // Print a 3-D vector
318 // NOTE:
319 // Function is only defined when _VECTORMATH_DEBUG is defined.
320 //
321 inline void print( const Vector3 & vec );
322 
323 // Print a 3-D vector and an associated string identifier
324 // NOTE:
325 // Function is only defined when _VECTORMATH_DEBUG is defined.
326 //
327 inline void print( const Vector3 & vec, const char * name );
328 
329 #endif
330 
331 // A 4-D vector in array-of-structures format
332 //
333 class Vector4
334 {
335  float mX;
336  float mY;
337  float mZ;
338  float mW;
339 
340 public:
341  // Default constructor; does no initialization
342  //
343  inline Vector4( ) { };
344 
345  // Copy a 4-D vector
346  //
347  inline Vector4( const Vector4 & vec );
348 
349  // Construct a 4-D vector from x, y, z, and w elements
350  //
351  inline Vector4( float x, float y, float z, float w );
352 
353  // Construct a 4-D vector from a 3-D vector and a scalar
354  //
355  inline Vector4( const Vector3 & xyz, float w );
356 
357  // Copy x, y, and z from a 3-D vector into a 4-D vector, and set w to 0
358  //
359  explicit inline Vector4( const Vector3 & vec );
360 
361  // Copy x, y, and z from a 3-D point into a 4-D vector, and set w to 1
362  //
363  explicit inline Vector4( const Point3 & pnt );
364 
365  // Copy elements from a quaternion into a 4-D vector
366  //
367  explicit inline Vector4( const Quat & quat );
368 
369  // Set all elements of a 4-D vector to the same scalar value
370  //
371  explicit inline Vector4( float scalar );
372 
373  // Assign one 4-D vector to another
374  //
375  inline Vector4 & operator =( const Vector4 & vec );
376 
377  // Set the x, y, and z elements of a 4-D vector
378  // NOTE:
379  // This function does not change the w element.
380  //
381  inline Vector4 & setXYZ( const Vector3 & vec );
382 
383  // Get the x, y, and z elements of a 4-D vector
384  //
385  inline const Vector3 getXYZ( ) const;
386 
387  // Set the x element of a 4-D vector
388  //
389  inline Vector4 & setX( float x );
390 
391  // Set the y element of a 4-D vector
392  //
393  inline Vector4 & setY( float y );
394 
395  // Set the z element of a 4-D vector
396  //
397  inline Vector4 & setZ( float z );
398 
399  // Set the w element of a 4-D vector
400  //
401  inline Vector4 & setW( float w );
402 
403  // Get the x element of a 4-D vector
404  //
405  inline float getX( ) const;
406 
407  // Get the y element of a 4-D vector
408  //
409  inline float getY( ) const;
410 
411  // Get the z element of a 4-D vector
412  //
413  inline float getZ( ) const;
414 
415  // Get the w element of a 4-D vector
416  //
417  inline float getW( ) const;
418 
419  // Set an x, y, z, or w element of a 4-D vector by index
420  //
421  inline Vector4 & setElem( int idx, float value );
422 
423  // Get an x, y, z, or w element of a 4-D vector by index
424  //
425  inline float getElem( int idx ) const;
426 
427  // Subscripting operator to set or get an element
428  //
429  inline float & operator []( int idx );
430 
431  // Subscripting operator to get an element
432  //
433  inline float operator []( int idx ) const;
434 
435  // Add two 4-D vectors
436  //
437  inline const Vector4 operator +( const Vector4 & vec ) const;
438 
439  // Subtract a 4-D vector from another 4-D vector
440  //
441  inline const Vector4 operator -( const Vector4 & vec ) const;
442 
443  // Multiply a 4-D vector by a scalar
444  //
445  inline const Vector4 operator *( float scalar ) const;
446 
447  // Divide a 4-D vector by a scalar
448  //
449  inline const Vector4 operator /( float scalar ) const;
450 
451  // Perform compound assignment and addition with a 4-D vector
452  //
453  inline Vector4 & operator +=( const Vector4 & vec );
454 
455  // Perform compound assignment and subtraction by a 4-D vector
456  //
457  inline Vector4 & operator -=( const Vector4 & vec );
458 
459  // Perform compound assignment and multiplication by a scalar
460  //
461  inline Vector4 & operator *=( float scalar );
462 
463  // Perform compound assignment and division by a scalar
464  //
465  inline Vector4 & operator /=( float scalar );
466 
467  // Negate all elements of a 4-D vector
468  //
469  inline const Vector4 operator -( ) const;
470 
471  // Construct x axis
472  //
473  static inline const Vector4 xAxis( );
474 
475  // Construct y axis
476  //
477  static inline const Vector4 yAxis( );
478 
479  // Construct z axis
480  //
481  static inline const Vector4 zAxis( );
482 
483  // Construct w axis
484  //
485  static inline const Vector4 wAxis( );
486 
487 }
488 #ifdef __GNUC__
489 __attribute__ ((aligned(16)))
490 #endif
491 ;
492 
493 // Multiply a 4-D vector by a scalar
494 //
495 inline const Vector4 operator *( float scalar, const Vector4 & vec );
496 
497 // Multiply two 4-D vectors per element
498 //
499 inline const Vector4 mulPerElem( const Vector4 & vec0, const Vector4 & vec1 );
500 
501 // Divide two 4-D vectors per element
502 // NOTE:
503 // Floating-point behavior matches standard library function divf4.
504 //
505 inline const Vector4 divPerElem( const Vector4 & vec0, const Vector4 & vec1 );
506 
507 // Compute the reciprocal of a 4-D vector per element
508 // NOTE:
509 // Floating-point behavior matches standard library function recipf4.
510 //
511 inline const Vector4 recipPerElem( const Vector4 & vec );
512 
513 // Compute the square root of a 4-D vector per element
514 // NOTE:
515 // Floating-point behavior matches standard library function sqrtf4.
516 //
517 inline const Vector4 sqrtPerElem( const Vector4 & vec );
518 
519 // Compute the reciprocal square root of a 4-D vector per element
520 // NOTE:
521 // Floating-point behavior matches standard library function rsqrtf4.
522 //
523 inline const Vector4 rsqrtPerElem( const Vector4 & vec );
524 
525 // Compute the absolute value of a 4-D vector per element
526 //
527 inline const Vector4 absPerElem( const Vector4 & vec );
528 
529 // Copy sign from one 4-D vector to another, per element
530 //
531 inline const Vector4 copySignPerElem( const Vector4 & vec0, const Vector4 & vec1 );
532 
533 // Maximum of two 4-D vectors per element
534 //
535 inline const Vector4 maxPerElem( const Vector4 & vec0, const Vector4 & vec1 );
536 
537 // Minimum of two 4-D vectors per element
538 //
539 inline const Vector4 minPerElem( const Vector4 & vec0, const Vector4 & vec1 );
540 
541 // Maximum element of a 4-D vector
542 //
543 inline float maxElem( const Vector4 & vec );
544 
545 // Minimum element of a 4-D vector
546 //
547 inline float minElem( const Vector4 & vec );
548 
549 // Compute the sum of all elements of a 4-D vector
550 //
551 inline float sum( const Vector4 & vec );
552 
553 // Compute the dot product of two 4-D vectors
554 //
555 inline float dot( const Vector4 & vec0, const Vector4 & vec1 );
556 
557 // Compute the square of the length of a 4-D vector
558 //
559 inline float lengthSqr( const Vector4 & vec );
560 
561 // Compute the length of a 4-D vector
562 //
563 inline float length( const Vector4 & vec );
564 
565 // Normalize a 4-D vector
566 // NOTE:
567 // The result is unpredictable when all elements of vec are at or near zero.
568 //
569 inline const Vector4 normalize( const Vector4 & vec );
570 
571 // Outer product of two 4-D vectors
572 //
573 inline const Matrix4 outer( const Vector4 & vec0, const Vector4 & vec1 );
574 
575 // Linear interpolation between two 4-D vectors
576 // NOTE:
577 // Does not clamp t between 0 and 1.
578 //
579 inline const Vector4 lerp( float t, const Vector4 & vec0, const Vector4 & vec1 );
580 
581 // Spherical linear interpolation between two 4-D vectors
582 // NOTE:
583 // The result is unpredictable if the vectors point in opposite directions.
584 // Does not clamp t between 0 and 1.
585 //
586 inline const Vector4 slerp( float t, const Vector4 & unitVec0, const Vector4 & unitVec1 );
587 
588 // Conditionally select between two 4-D vectors
589 //
590 inline const Vector4 select( const Vector4 & vec0, const Vector4 & vec1, bool select1 );
591 
592 // Load x, y, z, and w elements from the first four words of a float array.
593 //
594 //
595 inline void loadXYZW( Vector4 & vec, const float * fptr );
596 
597 // Store x, y, z, and w elements of a 4-D vector in the first four words of a float array.
598 // Memory area of previous 16 bytes and next 32 bytes from fptr might be accessed
599 //
600 inline void storeXYZW( const Vector4 & vec, float * fptr );
601 
602 // Load four-half-floats as a 4-D vector
603 // NOTE:
604 // This transformation does not support either denormalized numbers or NaNs.
605 //
606 inline void loadHalfFloats( Vector4 & vec, const unsigned short * hfptr );
607 
608 // Store a 4-D vector as half-floats. Memory area of previous 16 bytes and next 32 bytes from <code><i>hfptr</i></code> might be accessed.
609 // NOTE:
610 // This transformation does not support either denormalized numbers or NaNs. Memory area of previous 16 bytes and next 32 bytes from hfptr might be accessed.
611 //
612 inline void storeHalfFloats( const Vector4 & vec, unsigned short * hfptr );
613 
614 #ifdef _VECTORMATH_DEBUG
615 
616 // Print a 4-D vector
617 // NOTE:
618 // Function is only defined when _VECTORMATH_DEBUG is defined.
619 //
620 inline void print( const Vector4 & vec );
621 
622 // Print a 4-D vector and an associated string identifier
623 // NOTE:
624 // Function is only defined when _VECTORMATH_DEBUG is defined.
625 //
626 inline void print( const Vector4 & vec, const char * name );
627 
628 #endif
629 
630 // A 3-D point in array-of-structures format
631 //
632 class Point3
633 {
634  float mX;
635  float mY;
636  float mZ;
637 #ifndef __GNUC__
638  float d;
639 #endif
640 
641 public:
642  // Default constructor; does no initialization
643  //
644  inline Point3( ) { };
645 
646  // Copy a 3-D point
647  //
648  inline Point3( const Point3 & pnt );
649 
650  // Construct a 3-D point from x, y, and z elements
651  //
652  inline Point3( float x, float y, float z );
653 
654  // Copy elements from a 3-D vector into a 3-D point
655  //
656  explicit inline Point3( const Vector3 & vec );
657 
658  // Set all elements of a 3-D point to the same scalar value
659  //
660  explicit inline Point3( float scalar );
661 
662  // Assign one 3-D point to another
663  //
664  inline Point3 & operator =( const Point3 & pnt );
665 
666  // Set the x element of a 3-D point
667  //
668  inline Point3 & setX( float x );
669 
670  // Set the y element of a 3-D point
671  //
672  inline Point3 & setY( float y );
673 
674  // Set the z element of a 3-D point
675  //
676  inline Point3 & setZ( float z );
677 
678  // Get the x element of a 3-D point
679  //
680  inline float getX( ) const;
681 
682  // Get the y element of a 3-D point
683  //
684  inline float getY( ) const;
685 
686  // Get the z element of a 3-D point
687  //
688  inline float getZ( ) const;
689 
690  // Set an x, y, or z element of a 3-D point by index
691  //
692  inline Point3 & setElem( int idx, float value );
693 
694  // Get an x, y, or z element of a 3-D point by index
695  //
696  inline float getElem( int idx ) const;
697 
698  // Subscripting operator to set or get an element
699  //
700  inline float & operator []( int idx );
701 
702  // Subscripting operator to get an element
703  //
704  inline float operator []( int idx ) const;
705 
706  // Subtract a 3-D point from another 3-D point
707  //
708  inline const Vector3 operator -( const Point3 & pnt ) const;
709 
710  // Add a 3-D point to a 3-D vector
711  //
712  inline const Point3 operator +( const Vector3 & vec ) const;
713 
714  // Subtract a 3-D vector from a 3-D point
715  //
716  inline const Point3 operator -( const Vector3 & vec ) const;
717 
718  // Perform compound assignment and addition with a 3-D vector
719  //
720  inline Point3 & operator +=( const Vector3 & vec );
721 
722  // Perform compound assignment and subtraction by a 3-D vector
723  //
724  inline Point3 & operator -=( const Vector3 & vec );
725 
726 }
727 #ifdef __GNUC__
728 __attribute__ ((aligned(16)))
729 #endif
730 ;
731 
732 // Multiply two 3-D points per element
733 //
734 inline const Point3 mulPerElem( const Point3 & pnt0, const Point3 & pnt1 );
735 
736 // Divide two 3-D points per element
737 // NOTE:
738 // Floating-point behavior matches standard library function divf4.
739 //
740 inline const Point3 divPerElem( const Point3 & pnt0, const Point3 & pnt1 );
741 
742 // Compute the reciprocal of a 3-D point per element
743 // NOTE:
744 // Floating-point behavior matches standard library function recipf4.
745 //
746 inline const Point3 recipPerElem( const Point3 & pnt );
747 
748 // Compute the square root of a 3-D point per element
749 // NOTE:
750 // Floating-point behavior matches standard library function sqrtf4.
751 //
752 inline const Point3 sqrtPerElem( const Point3 & pnt );
753 
754 // Compute the reciprocal square root of a 3-D point per element
755 // NOTE:
756 // Floating-point behavior matches standard library function rsqrtf4.
757 //
758 inline const Point3 rsqrtPerElem( const Point3 & pnt );
759 
760 // Compute the absolute value of a 3-D point per element
761 //
762 inline const Point3 absPerElem( const Point3 & pnt );
763 
764 // Copy sign from one 3-D point to another, per element
765 //
766 inline const Point3 copySignPerElem( const Point3 & pnt0, const Point3 & pnt1 );
767 
768 // Maximum of two 3-D points per element
769 //
770 inline const Point3 maxPerElem( const Point3 & pnt0, const Point3 & pnt1 );
771 
772 // Minimum of two 3-D points per element
773 //
774 inline const Point3 minPerElem( const Point3 & pnt0, const Point3 & pnt1 );
775 
776 // Maximum element of a 3-D point
777 //
778 inline float maxElem( const Point3 & pnt );
779 
780 // Minimum element of a 3-D point
781 //
782 inline float minElem( const Point3 & pnt );
783 
784 // Compute the sum of all elements of a 3-D point
785 //
786 inline float sum( const Point3 & pnt );
787 
788 // Apply uniform scale to a 3-D point
789 //
790 inline const Point3 scale( const Point3 & pnt, float scaleVal );
791 
792 // Apply non-uniform scale to a 3-D point
793 //
794 inline const Point3 scale( const Point3 & pnt, const Vector3 & scaleVec );
795 
796 // Scalar projection of a 3-D point on a unit-length 3-D vector
797 //
798 inline float projection( const Point3 & pnt, const Vector3 & unitVec );
799 
800 // Compute the square of the distance of a 3-D point from the coordinate-system origin
801 //
802 inline float distSqrFromOrigin( const Point3 & pnt );
803 
804 // Compute the distance of a 3-D point from the coordinate-system origin
805 //
806 inline float distFromOrigin( const Point3 & pnt );
807 
808 // Compute the square of the distance between two 3-D points
809 //
810 inline float distSqr( const Point3 & pnt0, const Point3 & pnt1 );
811 
812 // Compute the distance between two 3-D points
813 //
814 inline float dist( const Point3 & pnt0, const Point3 & pnt1 );
815 
816 // Linear interpolation between two 3-D points
817 // NOTE:
818 // Does not clamp t between 0 and 1.
819 //
820 inline const Point3 lerp( float t, const Point3 & pnt0, const Point3 & pnt1 );
821 
822 // Conditionally select between two 3-D points
823 //
824 inline const Point3 select( const Point3 & pnt0, const Point3 & pnt1, bool select1 );
825 
826 // Load x, y, and z elements from the first three words of a float array.
827 //
828 //
829 inline void loadXYZ( Point3 & pnt, const float * fptr );
830 
831 // Store x, y, and z elements of a 3-D point in the first three words of a float array.
832 // Memory area of previous 16 bytes and next 32 bytes from fptr might be accessed
833 //
834 inline void storeXYZ( const Point3 & pnt, float * fptr );
835 
836 // Load three-half-floats as a 3-D point
837 // NOTE:
838 // This transformation does not support either denormalized numbers or NaNs.
839 //
840 inline void loadHalfFloats( Point3 & pnt, const unsigned short * hfptr );
841 
842 // Store a 3-D point as half-floats. Memory area of previous 16 bytes and next 32 bytes from <code><i>hfptr</i></code> might be accessed.
843 // NOTE:
844 // This transformation does not support either denormalized numbers or NaNs. Memory area of previous 16 bytes and next 32 bytes from hfptr might be accessed.
845 //
846 inline void storeHalfFloats( const Point3 & pnt, unsigned short * hfptr );
847 
848 #ifdef _VECTORMATH_DEBUG
849 
850 // Print a 3-D point
851 // NOTE:
852 // Function is only defined when _VECTORMATH_DEBUG is defined.
853 //
854 inline void print( const Point3 & pnt );
855 
856 // Print a 3-D point and an associated string identifier
857 // NOTE:
858 // Function is only defined when _VECTORMATH_DEBUG is defined.
859 //
860 inline void print( const Point3 & pnt, const char * name );
861 
862 #endif
863 
864 // A quaternion in array-of-structures format
865 //
866 class Quat
867 {
868  float mX;
869  float mY;
870  float mZ;
871  float mW;
872 
873 public:
874  // Default constructor; does no initialization
875  //
876  inline Quat( ) { };
877 
878  // Copy a quaternion
879  //
880  inline Quat( const Quat & quat );
881 
882  // Construct a quaternion from x, y, z, and w elements
883  //
884  inline Quat( float x, float y, float z, float w );
885 
886  // Construct a quaternion from a 3-D vector and a scalar
887  //
888  inline Quat( const Vector3 & xyz, float w );
889 
890  // Copy elements from a 4-D vector into a quaternion
891  //
892  explicit inline Quat( const Vector4 & vec );
893 
894  // Convert a rotation matrix to a unit-length quaternion
895  //
896  explicit inline Quat( const Matrix3 & rotMat );
897 
898  // Set all elements of a quaternion to the same scalar value
899  //
900  explicit inline Quat( float scalar );
901 
902  // Assign one quaternion to another
903  //
904  inline Quat & operator =( const Quat & quat );
905 
906  // Set the x, y, and z elements of a quaternion
907  // NOTE:
908  // This function does not change the w element.
909  //
910  inline Quat & setXYZ( const Vector3 & vec );
911 
912  // Get the x, y, and z elements of a quaternion
913  //
914  inline const Vector3 getXYZ( ) const;
915 
916  // Set the x element of a quaternion
917  //
918  inline Quat & setX( float x );
919 
920  // Set the y element of a quaternion
921  //
922  inline Quat & setY( float y );
923 
924  // Set the z element of a quaternion
925  //
926  inline Quat & setZ( float z );
927 
928  // Set the w element of a quaternion
929  //
930  inline Quat & setW( float w );
931 
932  // Get the x element of a quaternion
933  //
934  inline float getX( ) const;
935 
936  // Get the y element of a quaternion
937  //
938  inline float getY( ) const;
939 
940  // Get the z element of a quaternion
941  //
942  inline float getZ( ) const;
943 
944  // Get the w element of a quaternion
945  //
946  inline float getW( ) const;
947 
948  // Set an x, y, z, or w element of a quaternion by index
949  //
950  inline Quat & setElem( int idx, float value );
951 
952  // Get an x, y, z, or w element of a quaternion by index
953  //
954  inline float getElem( int idx ) const;
955 
956  // Subscripting operator to set or get an element
957  //
958  inline float & operator []( int idx );
959 
960  // Subscripting operator to get an element
961  //
962  inline float operator []( int idx ) const;
963 
964  // Add two quaternions
965  //
966  inline const Quat operator +( const Quat & quat ) const;
967 
968  // Subtract a quaternion from another quaternion
969  //
970  inline const Quat operator -( const Quat & quat ) const;
971 
972  // Multiply two quaternions
973  //
974  inline const Quat operator *( const Quat & quat ) const;
975 
976  // Multiply a quaternion by a scalar
977  //
978  inline const Quat operator *( float scalar ) const;
979 
980  // Divide a quaternion by a scalar
981  //
982  inline const Quat operator /( float scalar ) const;
983 
984  // Perform compound assignment and addition with a quaternion
985  //
986  inline Quat & operator +=( const Quat & quat );
987 
988  // Perform compound assignment and subtraction by a quaternion
989  //
990  inline Quat & operator -=( const Quat & quat );
991 
992  // Perform compound assignment and multiplication by a quaternion
993  //
994  inline Quat & operator *=( const Quat & quat );
995 
996  // Perform compound assignment and multiplication by a scalar
997  //
998  inline Quat & operator *=( float scalar );
999 
1000  // Perform compound assignment and division by a scalar
1001  //
1002  inline Quat & operator /=( float scalar );
1003 
1004  // Negate all elements of a quaternion
1005  //
1006  inline const Quat operator -( ) const;
1007 
1008  // Construct an identity quaternion
1009  //
1010  static inline const Quat identity( );
1011 
1012  // Construct a quaternion to rotate between two unit-length 3-D vectors
1013  // NOTE:
1014  // The result is unpredictable if unitVec0 and unitVec1 point in opposite directions.
1015  //
1016  static inline const Quat rotation( const Vector3 & unitVec0, const Vector3 & unitVec1 );
1017 
1018  // Construct a quaternion to rotate around a unit-length 3-D vector
1019  //
1020  static inline const Quat rotation( float radians, const Vector3 & unitVec );
1021 
1022  // Construct a quaternion to rotate around the x axis
1023  //
1024  static inline const Quat rotationX( float radians );
1025 
1026  // Construct a quaternion to rotate around the y axis
1027  //
1028  static inline const Quat rotationY( float radians );
1029 
1030  // Construct a quaternion to rotate around the z axis
1031  //
1032  static inline const Quat rotationZ( float radians );
1033 
1034 }
1035 #ifdef __GNUC__
1036 __attribute__ ((aligned(16)))
1037 #endif
1038 ;
1039 
1040 // Multiply a quaternion by a scalar
1041 //
1042 inline const Quat operator *( float scalar, const Quat & quat );
1043 
1044 // Compute the conjugate of a quaternion
1045 //
1046 inline const Quat conj( const Quat & quat );
1047 
1048 // Use a unit-length quaternion to rotate a 3-D vector
1049 //
1050 inline const Vector3 rotate( const Quat & unitQuat, const Vector3 & vec );
1051 
1052 // Compute the dot product of two quaternions
1053 //
1054 inline float dot( const Quat & quat0, const Quat & quat1 );
1055 
1056 // Compute the norm of a quaternion
1057 //
1058 inline float norm( const Quat & quat );
1059 
1060 // Compute the length of a quaternion
1061 //
1062 inline float length( const Quat & quat );
1063 
1064 // Normalize a quaternion
1065 // NOTE:
1066 // The result is unpredictable when all elements of quat are at or near zero.
1067 //
1068 inline const Quat normalize( const Quat & quat );
1069 
1070 // Linear interpolation between two quaternions
1071 // NOTE:
1072 // Does not clamp t between 0 and 1.
1073 //
1074 inline const Quat lerp( float t, const Quat & quat0, const Quat & quat1 );
1075 
1076 // Spherical linear interpolation between two quaternions
1077 // NOTE:
1078 // Interpolates along the shortest path between orientations.
1079 // Does not clamp t between 0 and 1.
1080 //
1081 inline const Quat slerp( float t, const Quat & unitQuat0, const Quat & unitQuat1 );
1082 
1083 // Spherical quadrangle interpolation
1084 //
1085 inline const Quat squad( float t, const Quat & unitQuat0, const Quat & unitQuat1, const Quat & unitQuat2, const Quat & unitQuat3 );
1086 
1087 // Conditionally select between two quaternions
1088 //
1089 inline const Quat select( const Quat & quat0, const Quat & quat1, bool select1 );
1090 
1091 // Load x, y, z, and w elements from the first four words of a float array.
1092 //
1093 //
1094 inline void loadXYZW( Quat & quat, const float * fptr );
1095 
1096 // Store x, y, z, and w elements of a quaternion in the first four words of a float array.
1097 // Memory area of previous 16 bytes and next 32 bytes from fptr might be accessed
1098 //
1099 inline void storeXYZW( const Quat & quat, float * fptr );
1100 
1101 #ifdef _VECTORMATH_DEBUG
1102 
1103 // Print a quaternion
1104 // NOTE:
1105 // Function is only defined when _VECTORMATH_DEBUG is defined.
1106 //
1107 inline void print( const Quat & quat );
1108 
1109 // Print a quaternion and an associated string identifier
1110 // NOTE:
1111 // Function is only defined when _VECTORMATH_DEBUG is defined.
1112 //
1113 inline void print( const Quat & quat, const char * name );
1114 
1115 #endif
1116 
1117 // A 3x3 matrix in array-of-structures format
1118 //
1119 class Matrix3
1120 {
1121  Vector3 mCol0;
1122  Vector3 mCol1;
1123  Vector3 mCol2;
1124 
1125 public:
1126  // Default constructor; does no initialization
1127  //
1128  inline Matrix3( ) { };
1129 
1130  // Copy a 3x3 matrix
1131  //
1132  inline Matrix3( const Matrix3 & mat );
1133 
1134  // Construct a 3x3 matrix containing the specified columns
1135  //
1136  inline Matrix3( const Vector3 & col0, const Vector3 & col1, const Vector3 & col2 );
1137 
1138  // Construct a 3x3 rotation matrix from a unit-length quaternion
1139  //
1140  explicit inline Matrix3( const Quat & unitQuat );
1141 
1142  // Set all elements of a 3x3 matrix to the same scalar value
1143  //
1144  explicit inline Matrix3( float scalar );
1145 
1146  // Assign one 3x3 matrix to another
1147  //
1148  inline Matrix3 & operator =( const Matrix3 & mat );
1149 
1150  // Set column 0 of a 3x3 matrix
1151  //
1152  inline Matrix3 & setCol0( const Vector3 & col0 );
1153 
1154  // Set column 1 of a 3x3 matrix
1155  //
1156  inline Matrix3 & setCol1( const Vector3 & col1 );
1157 
1158  // Set column 2 of a 3x3 matrix
1159  //
1160  inline Matrix3 & setCol2( const Vector3 & col2 );
1161 
1162  // Get column 0 of a 3x3 matrix
1163  //
1164  inline const Vector3 getCol0( ) const;
1165 
1166  // Get column 1 of a 3x3 matrix
1167  //
1168  inline const Vector3 getCol1( ) const;
1169 
1170  // Get column 2 of a 3x3 matrix
1171  //
1172  inline const Vector3 getCol2( ) const;
1173 
1174  // Set the column of a 3x3 matrix referred to by the specified index
1175  //
1176  inline Matrix3 & setCol( int col, const Vector3 & vec );
1177 
1178  // Set the row of a 3x3 matrix referred to by the specified index
1179  //
1180  inline Matrix3 & setRow( int row, const Vector3 & vec );
1181 
1182  // Get the column of a 3x3 matrix referred to by the specified index
1183  //
1184  inline const Vector3 getCol( int col ) const;
1185 
1186  // Get the row of a 3x3 matrix referred to by the specified index
1187  //
1188  inline const Vector3 getRow( int row ) const;
1189 
1190  // Subscripting operator to set or get a column
1191  //
1192  inline Vector3 & operator []( int col );
1193 
1194  // Subscripting operator to get a column
1195  //
1196  inline const Vector3 operator []( int col ) const;
1197 
1198  // Set the element of a 3x3 matrix referred to by column and row indices
1199  //
1200  inline Matrix3 & setElem( int col, int row, float val );
1201 
1202  // Get the element of a 3x3 matrix referred to by column and row indices
1203  //
1204  inline float getElem( int col, int row ) const;
1205 
1206  // Add two 3x3 matrices
1207  //
1208  inline const Matrix3 operator +( const Matrix3 & mat ) const;
1209 
1210  // Subtract a 3x3 matrix from another 3x3 matrix
1211  //
1212  inline const Matrix3 operator -( const Matrix3 & mat ) const;
1213 
1214  // Negate all elements of a 3x3 matrix
1215  //
1216  inline const Matrix3 operator -( ) const;
1217 
1218  // Multiply a 3x3 matrix by a scalar
1219  //
1220  inline const Matrix3 operator *( float scalar ) const;
1221 
1222  // Multiply a 3x3 matrix by a 3-D vector
1223  //
1224  inline const Vector3 operator *( const Vector3 & vec ) const;
1225 
1226  // Multiply two 3x3 matrices
1227  //
1228  inline const Matrix3 operator *( const Matrix3 & mat ) const;
1229 
1230  // Perform compound assignment and addition with a 3x3 matrix
1231  //
1232  inline Matrix3 & operator +=( const Matrix3 & mat );
1233 
1234  // Perform compound assignment and subtraction by a 3x3 matrix
1235  //
1236  inline Matrix3 & operator -=( const Matrix3 & mat );
1237 
1238  // Perform compound assignment and multiplication by a scalar
1239  //
1240  inline Matrix3 & operator *=( float scalar );
1241 
1242  // Perform compound assignment and multiplication by a 3x3 matrix
1243  //
1244  inline Matrix3 & operator *=( const Matrix3 & mat );
1245 
1246  // Construct an identity 3x3 matrix
1247  //
1248  static inline const Matrix3 identity( );
1249 
1250  // Construct a 3x3 matrix to rotate around the x axis
1251  //
1252  static inline const Matrix3 rotationX( float radians );
1253 
1254  // Construct a 3x3 matrix to rotate around the y axis
1255  //
1256  static inline const Matrix3 rotationY( float radians );
1257 
1258  // Construct a 3x3 matrix to rotate around the z axis
1259  //
1260  static inline const Matrix3 rotationZ( float radians );
1261 
1262  // Construct a 3x3 matrix to rotate around the x, y, and z axes
1263  //
1264  static inline const Matrix3 rotationZYX( const Vector3 & radiansXYZ );
1265 
1266  // Construct a 3x3 matrix to rotate around a unit-length 3-D vector
1267  //
1268  static inline const Matrix3 rotation( float radians, const Vector3 & unitVec );
1269 
1270  // Construct a rotation matrix from a unit-length quaternion
1271  //
1272  static inline const Matrix3 rotation( const Quat & unitQuat );
1273 
1274  // Construct a 3x3 matrix to perform scaling
1275  //
1276  static inline const Matrix3 scale( const Vector3 & scaleVec );
1277 
1278 };
1279 // Multiply a 3x3 matrix by a scalar
1280 //
1281 inline const Matrix3 operator *( float scalar, const Matrix3 & mat );
1282 
1283 // Append (post-multiply) a scale transformation to a 3x3 matrix
1284 // NOTE:
1285 // Faster than creating and multiplying a scale transformation matrix.
1286 //
1287 inline const Matrix3 appendScale( const Matrix3 & mat, const Vector3 & scaleVec );
1288 
1289 // Prepend (pre-multiply) a scale transformation to a 3x3 matrix
1290 // NOTE:
1291 // Faster than creating and multiplying a scale transformation matrix.
1292 //
1293 inline const Matrix3 prependScale( const Vector3 & scaleVec, const Matrix3 & mat );
1294 
1295 // Multiply two 3x3 matrices per element
1296 //
1297 inline const Matrix3 mulPerElem( const Matrix3 & mat0, const Matrix3 & mat1 );
1298 
1299 // Compute the absolute value of a 3x3 matrix per element
1300 //
1301 inline const Matrix3 absPerElem( const Matrix3 & mat );
1302 
1303 // Transpose of a 3x3 matrix
1304 //
1305 inline const Matrix3 transpose( const Matrix3 & mat );
1306 
1307 // Compute the inverse of a 3x3 matrix
1308 // NOTE:
1309 // Result is unpredictable when the determinant of mat is equal to or near 0.
1310 //
1311 inline const Matrix3 inverse( const Matrix3 & mat );
1312 
1313 // Determinant of a 3x3 matrix
1314 //
1315 inline float determinant( const Matrix3 & mat );
1316 
1317 // Conditionally select between two 3x3 matrices
1318 //
1319 inline const Matrix3 select( const Matrix3 & mat0, const Matrix3 & mat1, bool select1 );
1320 
1321 #ifdef _VECTORMATH_DEBUG
1322 
1323 // Print a 3x3 matrix
1324 // NOTE:
1325 // Function is only defined when _VECTORMATH_DEBUG is defined.
1326 //
1327 inline void print( const Matrix3 & mat );
1328 
1329 // Print a 3x3 matrix and an associated string identifier
1330 // NOTE:
1331 // Function is only defined when _VECTORMATH_DEBUG is defined.
1332 //
1333 inline void print( const Matrix3 & mat, const char * name );
1334 
1335 #endif
1336 
1337 // A 4x4 matrix in array-of-structures format
1338 //
1339 class Matrix4
1340 {
1341  Vector4 mCol0;
1342  Vector4 mCol1;
1343  Vector4 mCol2;
1344  Vector4 mCol3;
1345 
1346 public:
1347  // Default constructor; does no initialization
1348  //
1349  inline Matrix4( ) { };
1350 
1351  // Copy a 4x4 matrix
1352  //
1353  inline Matrix4( const Matrix4 & mat );
1354 
1355  // Construct a 4x4 matrix containing the specified columns
1356  //
1357  inline Matrix4( const Vector4 & col0, const Vector4 & col1, const Vector4 & col2, const Vector4 & col3 );
1358 
1359  // Construct a 4x4 matrix from a 3x4 transformation matrix
1360  //
1361  explicit inline Matrix4( const Transform3 & mat );
1362 
1363  // Construct a 4x4 matrix from a 3x3 matrix and a 3-D vector
1364  //
1365  inline Matrix4( const Matrix3 & mat, const Vector3 & translateVec );
1366 
1367  // Construct a 4x4 matrix from a unit-length quaternion and a 3-D vector
1368  //
1369  inline Matrix4( const Quat & unitQuat, const Vector3 & translateVec );
1370 
1371  // Set all elements of a 4x4 matrix to the same scalar value
1372  //
1373  explicit inline Matrix4( float scalar );
1374 
1375  // Assign one 4x4 matrix to another
1376  //
1377  inline Matrix4 & operator =( const Matrix4 & mat );
1378 
1379  // Set the upper-left 3x3 submatrix
1380  // NOTE:
1381  // This function does not change the bottom row elements.
1382  //
1383  inline Matrix4 & setUpper3x3( const Matrix3 & mat3 );
1384 
1385  // Get the upper-left 3x3 submatrix of a 4x4 matrix
1386  //
1387  inline const Matrix3 getUpper3x3( ) const;
1388 
1389  // Set translation component
1390  // NOTE:
1391  // This function does not change the bottom row elements.
1392  //
1393  inline Matrix4 & setTranslation( const Vector3 & translateVec );
1394 
1395  // Get the translation component of a 4x4 matrix
1396  //
1397  inline const Vector3 getTranslation( ) const;
1398 
1399  // Set column 0 of a 4x4 matrix
1400  //
1401  inline Matrix4 & setCol0( const Vector4 & col0 );
1402 
1403  // Set column 1 of a 4x4 matrix
1404  //
1405  inline Matrix4 & setCol1( const Vector4 & col1 );
1406 
1407  // Set column 2 of a 4x4 matrix
1408  //
1409  inline Matrix4 & setCol2( const Vector4 & col2 );
1410 
1411  // Set column 3 of a 4x4 matrix
1412  //
1413  inline Matrix4 & setCol3( const Vector4 & col3 );
1414 
1415  // Get column 0 of a 4x4 matrix
1416  //
1417  inline const Vector4 getCol0( ) const;
1418 
1419  // Get column 1 of a 4x4 matrix
1420  //
1421  inline const Vector4 getCol1( ) const;
1422 
1423  // Get column 2 of a 4x4 matrix
1424  //
1425  inline const Vector4 getCol2( ) const;
1426 
1427  // Get column 3 of a 4x4 matrix
1428  //
1429  inline const Vector4 getCol3( ) const;
1430 
1431  // Set the column of a 4x4 matrix referred to by the specified index
1432  //
1433  inline Matrix4 & setCol( int col, const Vector4 & vec );
1434 
1435  // Set the row of a 4x4 matrix referred to by the specified index
1436  //
1437  inline Matrix4 & setRow( int row, const Vector4 & vec );
1438 
1439  // Get the column of a 4x4 matrix referred to by the specified index
1440  //
1441  inline const Vector4 getCol( int col ) const;
1442 
1443  // Get the row of a 4x4 matrix referred to by the specified index
1444  //
1445  inline const Vector4 getRow( int row ) const;
1446 
1447  // Subscripting operator to set or get a column
1448  //
1449  inline Vector4 & operator []( int col );
1450 
1451  // Subscripting operator to get a column
1452  //
1453  inline const Vector4 operator []( int col ) const;
1454 
1455  // Set the element of a 4x4 matrix referred to by column and row indices
1456  //
1457  inline Matrix4 & setElem( int col, int row, float val );
1458 
1459  // Get the element of a 4x4 matrix referred to by column and row indices
1460  //
1461  inline float getElem( int col, int row ) const;
1462 
1463  // Add two 4x4 matrices
1464  //
1465  inline const Matrix4 operator +( const Matrix4 & mat ) const;
1466 
1467  // Subtract a 4x4 matrix from another 4x4 matrix
1468  //
1469  inline const Matrix4 operator -( const Matrix4 & mat ) const;
1470 
1471  // Negate all elements of a 4x4 matrix
1472  //
1473  inline const Matrix4 operator -( ) const;
1474 
1475  // Multiply a 4x4 matrix by a scalar
1476  //
1477  inline const Matrix4 operator *( float scalar ) const;
1478 
1479  // Multiply a 4x4 matrix by a 4-D vector
1480  //
1481  inline const Vector4 operator *( const Vector4 & vec ) const;
1482 
1483  // Multiply a 4x4 matrix by a 3-D vector
1484  //
1485  inline const Vector4 operator *( const Vector3 & vec ) const;
1486 
1487  // Multiply a 4x4 matrix by a 3-D point
1488  //
1489  inline const Vector4 operator *( const Point3 & pnt ) const;
1490 
1491  // Multiply two 4x4 matrices
1492  //
1493  inline const Matrix4 operator *( const Matrix4 & mat ) const;
1494 
1495  // Multiply a 4x4 matrix by a 3x4 transformation matrix
1496  //
1497  inline const Matrix4 operator *( const Transform3 & tfrm ) const;
1498 
1499  // Perform compound assignment and addition with a 4x4 matrix
1500  //
1501  inline Matrix4 & operator +=( const Matrix4 & mat );
1502 
1503  // Perform compound assignment and subtraction by a 4x4 matrix
1504  //
1505  inline Matrix4 & operator -=( const Matrix4 & mat );
1506 
1507  // Perform compound assignment and multiplication by a scalar
1508  //
1509  inline Matrix4 & operator *=( float scalar );
1510 
1511  // Perform compound assignment and multiplication by a 4x4 matrix
1512  //
1513  inline Matrix4 & operator *=( const Matrix4 & mat );
1514 
1515  // Perform compound assignment and multiplication by a 3x4 transformation matrix
1516  //
1517  inline Matrix4 & operator *=( const Transform3 & tfrm );
1518 
1519  // Construct an identity 4x4 matrix
1520  //
1521  static inline const Matrix4 identity( );
1522 
1523  // Construct a 4x4 matrix to rotate around the x axis
1524  //
1525  static inline const Matrix4 rotationX( float radians );
1526 
1527  // Construct a 4x4 matrix to rotate around the y axis
1528  //
1529  static inline const Matrix4 rotationY( float radians );
1530 
1531  // Construct a 4x4 matrix to rotate around the z axis
1532  //
1533  static inline const Matrix4 rotationZ( float radians );
1534 
1535  // Construct a 4x4 matrix to rotate around the x, y, and z axes
1536  //
1537  static inline const Matrix4 rotationZYX( const Vector3 & radiansXYZ );
1538 
1539  // Construct a 4x4 matrix to rotate around a unit-length 3-D vector
1540  //
1541  static inline const Matrix4 rotation( float radians, const Vector3 & unitVec );
1542 
1543  // Construct a rotation matrix from a unit-length quaternion
1544  //
1545  static inline const Matrix4 rotation( const Quat & unitQuat );
1546 
1547  // Construct a 4x4 matrix to perform scaling
1548  //
1549  static inline const Matrix4 scale( const Vector3 & scaleVec );
1550 
1551  // Construct a 4x4 matrix to perform translation
1552  //
1553  static inline const Matrix4 translation( const Vector3 & translateVec );
1554 
1555  // Construct viewing matrix based on eye position, position looked at, and up direction
1556  //
1557  static inline const Matrix4 lookAt( const Point3 & eyePos, const Point3 & lookAtPos, const Vector3 & upVec );
1558 
1559  // Construct a perspective projection matrix
1560  //
1561  static inline const Matrix4 perspective( float fovyRadians, float aspect, float zNear, float zFar );
1562 
1563  // Construct a perspective projection matrix based on frustum
1564  //
1565  static inline const Matrix4 frustum( float left, float right, float bottom, float top, float zNear, float zFar );
1566 
1567  // Construct an orthographic projection matrix
1568  //
1569  static inline const Matrix4 orthographic( float left, float right, float bottom, float top, float zNear, float zFar );
1570 
1571 };
1572 // Multiply a 4x4 matrix by a scalar
1573 //
1574 inline const Matrix4 operator *( float scalar, const Matrix4 & mat );
1575 
1576 // Append (post-multiply) a scale transformation to a 4x4 matrix
1577 // NOTE:
1578 // Faster than creating and multiplying a scale transformation matrix.
1579 //
1580 inline const Matrix4 appendScale( const Matrix4 & mat, const Vector3 & scaleVec );
1581 
1582 // Prepend (pre-multiply) a scale transformation to a 4x4 matrix
1583 // NOTE:
1584 // Faster than creating and multiplying a scale transformation matrix.
1585 //
1586 inline const Matrix4 prependScale( const Vector3 & scaleVec, const Matrix4 & mat );
1587 
1588 // Multiply two 4x4 matrices per element
1589 //
1590 inline const Matrix4 mulPerElem( const Matrix4 & mat0, const Matrix4 & mat1 );
1591 
1592 // Compute the absolute value of a 4x4 matrix per element
1593 //
1594 inline const Matrix4 absPerElem( const Matrix4 & mat );
1595 
1596 // Transpose of a 4x4 matrix
1597 //
1598 inline const Matrix4 transpose( const Matrix4 & mat );
1599 
1600 // Compute the inverse of a 4x4 matrix
1601 // NOTE:
1602 // Result is unpredictable when the determinant of mat is equal to or near 0.
1603 //
1604 inline const Matrix4 inverse( const Matrix4 & mat );
1605 
1606 // Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix
1607 // NOTE:
1608 // 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.
1609 //
1610 inline const Matrix4 affineInverse( const Matrix4 & mat );
1611 
1612 // Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix with an orthogonal upper-left 3x3 submatrix
1613 // NOTE:
1614 // This can be used to achieve better performance than a general inverse when the specified 4x4 matrix meets the given restrictions.
1615 //
1616 inline const Matrix4 orthoInverse( const Matrix4 & mat );
1617 
1618 // Determinant of a 4x4 matrix
1619 //
1620 inline float determinant( const Matrix4 & mat );
1621 
1622 // Conditionally select between two 4x4 matrices
1623 //
1624 inline const Matrix4 select( const Matrix4 & mat0, const Matrix4 & mat1, bool select1 );
1625 
1626 #ifdef _VECTORMATH_DEBUG
1627 
1628 // Print a 4x4 matrix
1629 // NOTE:
1630 // Function is only defined when _VECTORMATH_DEBUG is defined.
1631 //
1632 inline void print( const Matrix4 & mat );
1633 
1634 // Print a 4x4 matrix and an associated string identifier
1635 // NOTE:
1636 // Function is only defined when _VECTORMATH_DEBUG is defined.
1637 //
1638 inline void print( const Matrix4 & mat, const char * name );
1639 
1640 #endif
1641 
1642 // A 3x4 transformation matrix in array-of-structures format
1643 //
1644 class Transform3
1645 {
1646  Vector3 mCol0;
1647  Vector3 mCol1;
1648  Vector3 mCol2;
1649  Vector3 mCol3;
1650 
1651 public:
1652  // Default constructor; does no initialization
1653  //
1654  inline Transform3( ) { };
1655 
1656  // Copy a 3x4 transformation matrix
1657  //
1658  inline Transform3( const Transform3 & tfrm );
1659 
1660  // Construct a 3x4 transformation matrix containing the specified columns
1661  //
1662  inline Transform3( const Vector3 & col0, const Vector3 & col1, const Vector3 & col2, const Vector3 & col3 );
1663 
1664  // Construct a 3x4 transformation matrix from a 3x3 matrix and a 3-D vector
1665  //
1666  inline Transform3( const Matrix3 & tfrm, const Vector3 & translateVec );
1667 
1668  // Construct a 3x4 transformation matrix from a unit-length quaternion and a 3-D vector
1669  //
1670  inline Transform3( const Quat & unitQuat, const Vector3 & translateVec );
1671 
1672  // Set all elements of a 3x4 transformation matrix to the same scalar value
1673  //
1674  explicit inline Transform3( float scalar );
1675 
1676  // Assign one 3x4 transformation matrix to another
1677  //
1678  inline Transform3 & operator =( const Transform3 & tfrm );
1679 
1680  // Set the upper-left 3x3 submatrix
1681  //
1682  inline Transform3 & setUpper3x3( const Matrix3 & mat3 );
1683 
1684  // Get the upper-left 3x3 submatrix of a 3x4 transformation matrix
1685  //
1686  inline const Matrix3 getUpper3x3( ) const;
1687 
1688  // Set translation component
1689  //
1690  inline Transform3 & setTranslation( const Vector3 & translateVec );
1691 
1692  // Get the translation component of a 3x4 transformation matrix
1693  //
1694  inline const Vector3 getTranslation( ) const;
1695 
1696  // Set column 0 of a 3x4 transformation matrix
1697  //
1698  inline Transform3 & setCol0( const Vector3 & col0 );
1699 
1700  // Set column 1 of a 3x4 transformation matrix
1701  //
1702  inline Transform3 & setCol1( const Vector3 & col1 );
1703 
1704  // Set column 2 of a 3x4 transformation matrix
1705  //
1706  inline Transform3 & setCol2( const Vector3 & col2 );
1707 
1708  // Set column 3 of a 3x4 transformation matrix
1709  //
1710  inline Transform3 & setCol3( const Vector3 & col3 );
1711 
1712  // Get column 0 of a 3x4 transformation matrix
1713  //
1714  inline const Vector3 getCol0( ) const;
1715 
1716  // Get column 1 of a 3x4 transformation matrix
1717  //
1718  inline const Vector3 getCol1( ) const;
1719 
1720  // Get column 2 of a 3x4 transformation matrix
1721  //
1722  inline const Vector3 getCol2( ) const;
1723 
1724  // Get column 3 of a 3x4 transformation matrix
1725  //
1726  inline const Vector3 getCol3( ) const;
1727 
1728  // Set the column of a 3x4 transformation matrix referred to by the specified index
1729  //
1730  inline Transform3 & setCol( int col, const Vector3 & vec );
1731 
1732  // Set the row of a 3x4 transformation matrix referred to by the specified index
1733  //
1734  inline Transform3 & setRow( int row, const Vector4 & vec );
1735 
1736  // Get the column of a 3x4 transformation matrix referred to by the specified index
1737  //
1738  inline const Vector3 getCol( int col ) const;
1739 
1740  // Get the row of a 3x4 transformation matrix referred to by the specified index
1741  //
1742  inline const Vector4 getRow( int row ) const;
1743 
1744  // Subscripting operator to set or get a column
1745  //
1746  inline Vector3 & operator []( int col );
1747 
1748  // Subscripting operator to get a column
1749  //
1750  inline const Vector3 operator []( int col ) const;
1751 
1752  // Set the element of a 3x4 transformation matrix referred to by column and row indices
1753  //
1754  inline Transform3 & setElem( int col, int row, float val );
1755 
1756  // Get the element of a 3x4 transformation matrix referred to by column and row indices
1757  //
1758  inline float getElem( int col, int row ) const;
1759 
1760  // Multiply a 3x4 transformation matrix by a 3-D vector
1761  //
1762  inline const Vector3 operator *( const Vector3 & vec ) const;
1763 
1764  // Multiply a 3x4 transformation matrix by a 3-D point
1765  //
1766  inline const Point3 operator *( const Point3 & pnt ) const;
1767 
1768  // Multiply two 3x4 transformation matrices
1769  //
1770  inline const Transform3 operator *( const Transform3 & tfrm ) const;
1771 
1772  // Perform compound assignment and multiplication by a 3x4 transformation matrix
1773  //
1774  inline Transform3 & operator *=( const Transform3 & tfrm );
1775 
1776  // Construct an identity 3x4 transformation matrix
1777  //
1778  static inline const Transform3 identity( );
1779 
1780  // Construct a 3x4 transformation matrix to rotate around the x axis
1781  //
1782  static inline const Transform3 rotationX( float radians );
1783 
1784  // Construct a 3x4 transformation matrix to rotate around the y axis
1785  //
1786  static inline const Transform3 rotationY( float radians );
1787 
1788  // Construct a 3x4 transformation matrix to rotate around the z axis
1789  //
1790  static inline const Transform3 rotationZ( float radians );
1791 
1792  // Construct a 3x4 transformation matrix to rotate around the x, y, and z axes
1793  //
1794  static inline const Transform3 rotationZYX( const Vector3 & radiansXYZ );
1795 
1796  // Construct a 3x4 transformation matrix to rotate around a unit-length 3-D vector
1797  //
1798  static inline const Transform3 rotation( float radians, const Vector3 & unitVec );
1799 
1800  // Construct a rotation matrix from a unit-length quaternion
1801  //
1802  static inline const Transform3 rotation( const Quat & unitQuat );
1803 
1804  // Construct a 3x4 transformation matrix to perform scaling
1805  //
1806  static inline const Transform3 scale( const Vector3 & scaleVec );
1807 
1808  // Construct a 3x4 transformation matrix to perform translation
1809  //
1810  static inline const Transform3 translation( const Vector3 & translateVec );
1811 
1812 };
1813 // Append (post-multiply) a scale transformation to a 3x4 transformation matrix
1814 // NOTE:
1815 // Faster than creating and multiplying a scale transformation matrix.
1816 //
1817 inline const Transform3 appendScale( const Transform3 & tfrm, const Vector3 & scaleVec );
1818 
1819 // Prepend (pre-multiply) a scale transformation to a 3x4 transformation matrix
1820 // NOTE:
1821 // Faster than creating and multiplying a scale transformation matrix.
1822 //
1823 inline const Transform3 prependScale( const Vector3 & scaleVec, const Transform3 & tfrm );
1824 
1825 // Multiply two 3x4 transformation matrices per element
1826 //
1827 inline const Transform3 mulPerElem( const Transform3 & tfrm0, const Transform3 & tfrm1 );
1828 
1829 // Compute the absolute value of a 3x4 transformation matrix per element
1830 //
1831 inline const Transform3 absPerElem( const Transform3 & tfrm );
1832 
1833 // Inverse of a 3x4 transformation matrix
1834 // NOTE:
1835 // Result is unpredictable when the determinant of the left 3x3 submatrix is equal to or near 0.
1836 //
1837 inline const Transform3 inverse( const Transform3 & tfrm );
1838 
1839 // Compute the inverse of a 3x4 transformation matrix, expected to have an orthogonal upper-left 3x3 submatrix
1840 // NOTE:
1841 // This can be used to achieve better performance than a general inverse when the specified 3x4 transformation matrix meets the given restrictions.
1842 //
1843 inline const Transform3 orthoInverse( const Transform3 & tfrm );
1844 
1845 // Conditionally select between two 3x4 transformation matrices
1846 //
1847 inline const Transform3 select( const Transform3 & tfrm0, const Transform3 & tfrm1, bool select1 );
1848 
1849 #ifdef _VECTORMATH_DEBUG
1850 
1851 // Print a 3x4 transformation matrix
1852 // NOTE:
1853 // Function is only defined when _VECTORMATH_DEBUG is defined.
1854 //
1855 inline void print( const Transform3 & tfrm );
1856 
1857 // Print a 3x4 transformation matrix and an associated string identifier
1858 // NOTE:
1859 // Function is only defined when _VECTORMATH_DEBUG is defined.
1860 //
1861 inline void print( const Transform3 & tfrm, const char * name );
1862 
1863 #endif
1864 
1865 } // namespace Aos
1866 } // namespace Vectormath
1867 
1868 #include "vec_aos.h"
1869 #include "quat_aos.h"
1870 #include "mat_aos.h"
1871 
1872 #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
static const Vector4 yAxis()
Definition: neon/vec_aos.h:564
float minElem(const Vector3 &vec)
Definition: neon/vec_aos.h:422
void loadHalfFloats(Vector3 &vec, const unsigned short *hfptr)
Definition: neon/vec_aos.h:112
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)
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)
enum @25 __attribute__
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
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
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
Matrix3 & operator-=(const Matrix3 &mat)
Definition: neon/mat_aos.h:218
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)
const Matrix3 crossMatrix(const Vector3 &vec)
const Vector3 sqrtPerElem(const Vector3 &vec)
Definition: neon/vec_aos.h:360
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)
Vector3 & setY(float y)
Definition: neon/vec_aos.h:207
static const Matrix3 rotationZ(float radians)
Definition: neon/mat_aos.h:328
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)
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
Vector4 & operator[](int col)
Definition: neon/mat_aos.h:568
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
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
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
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
const Vector3 operator/(float scalar) const
Definition: neon/vec_aos.h:304
const Matrix3 operator-() const
Definition: neon/mat_aos.h:224
const Matrix3 getUpper3x3() const
Matrix3 & setCol1(const Vector3 &col1)
Definition: neon/mat_aos.h:82
Point3 & operator+=(const Vector3 &vec)
void loadXYZW(Quat &quat, const float *fptr)
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
const Vector3 rsqrtPerElem(const Vector3 &vec)
Definition: neon/vec_aos.h:369
float distSqr(const Point3 &pnt0, const Point3 &pnt1)
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
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)
void storeXYZW(const Quat &quat, float *fptr)
const Quat lerp(float t, const Quat &quat0, const Quat &quat1)
Definition: neon/quat_aos.h:73
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
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
Point3 & setX(float x)
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)
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
static const Transform3 rotationZYX(const Vector3 &radiansXYZ)
Vector4 & operator/=(float scalar)
Definition: neon/vec_aos.h:834
Transform3 & setUpper3x3(const Matrix3 &mat3)
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)
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)
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
void loadXYZ(Vector3 &vec, const float *fptr)
Definition: neon/vec_aos.h:100
const Quat slerp(float t, const Quat &unitQuat0, const Quat &unitQuat1)
Definition: neon/quat_aos.h:78