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