2 Copyright (C) 2009 Sony Computer Entertainment Inc.
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:
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.
17 #ifndef _VECTORMATH_AOS_CPP_H
18 #define _VECTORMATH_AOS_CPP_H
22 #ifdef _VECTORMATH_DEBUG
26 namespace Vectormath {
30 //-----------------------------------------------------------------------------
31 // Forward Declarations
42 // A 3-D vector in array-of-structures format
54 // Default constructor; does no initialization
56 inline Vector3( ) { };
60 inline Vector3( const Vector3 & vec );
62 // Construct a 3-D vector from x, y, and z elements
64 inline Vector3( float x, float y, float z );
66 // Copy elements from a 3-D point into a 3-D vector
68 explicit inline Vector3( const Point3 & pnt );
70 // Set all elements of a 3-D vector to the same scalar value
72 explicit inline Vector3( float scalar );
74 // Assign one 3-D vector to another
76 inline Vector3 & operator =( const Vector3 & vec );
78 // Set the x element of a 3-D vector
80 inline Vector3 & setX( float x );
82 // Set the y element of a 3-D vector
84 inline Vector3 & setY( float y );
86 // Set the z element of a 3-D vector
88 inline Vector3 & setZ( float z );
90 // Get the x element of a 3-D vector
92 inline float getX( ) const;
94 // Get the y element of a 3-D vector
96 inline float getY( ) const;
98 // Get the z element of a 3-D vector
100 inline float getZ( ) const;
102 // Set an x, y, or z element of a 3-D vector by index
104 inline Vector3 & setElem( int idx, float value );
106 // Get an x, y, or z element of a 3-D vector by index
108 inline float getElem( int idx ) const;
110 // Subscripting operator to set or get an element
112 inline float & operator []( int idx );
114 // Subscripting operator to get an element
116 inline float operator []( int idx ) const;
118 // Add two 3-D vectors
120 inline const Vector3 operator +( const Vector3 & vec ) const;
122 // Subtract a 3-D vector from another 3-D vector
124 inline const Vector3 operator -( const Vector3 & vec ) const;
126 // Add a 3-D vector to a 3-D point
128 inline const Point3 operator +( const Point3 & pnt ) const;
130 // Multiply a 3-D vector by a scalar
132 inline const Vector3 operator *( float scalar ) const;
134 // Divide a 3-D vector by a scalar
136 inline const Vector3 operator /( float scalar ) const;
138 // Perform compound assignment and addition with a 3-D vector
140 inline Vector3 & operator +=( const Vector3 & vec );
142 // Perform compound assignment and subtraction by a 3-D vector
144 inline Vector3 & operator -=( const Vector3 & vec );
146 // Perform compound assignment and multiplication by a scalar
148 inline Vector3 & operator *=( float scalar );
150 // Perform compound assignment and division by a scalar
152 inline Vector3 & operator /=( float scalar );
154 // Negate all elements of a 3-D vector
156 inline const Vector3 operator -( ) const;
160 static inline const Vector3 xAxis( );
164 static inline const Vector3 yAxis( );
168 static inline const Vector3 zAxis( );
172 __attribute__ ((aligned(16)))
176 // Multiply a 3-D vector by a scalar
178 inline const Vector3 operator *( float scalar, const Vector3 & vec );
180 // Multiply two 3-D vectors per element
182 inline const Vector3 mulPerElem( const Vector3 & vec0, const Vector3 & vec1 );
184 // Divide two 3-D vectors per element
186 // Floating-point behavior matches standard library function divf4.
188 inline const Vector3 divPerElem( const Vector3 & vec0, const Vector3 & vec1 );
190 // Compute the reciprocal of a 3-D vector per element
192 // Floating-point behavior matches standard library function recipf4.
194 inline const Vector3 recipPerElem( const Vector3 & vec );
196 // Compute the square root of a 3-D vector per element
198 // Floating-point behavior matches standard library function sqrtf4.
200 inline const Vector3 sqrtPerElem( const Vector3 & vec );
202 // Compute the reciprocal square root of a 3-D vector per element
204 // Floating-point behavior matches standard library function rsqrtf4.
206 inline const Vector3 rsqrtPerElem( const Vector3 & vec );
208 // Compute the absolute value of a 3-D vector per element
210 inline const Vector3 absPerElem( const Vector3 & vec );
212 // Copy sign from one 3-D vector to another, per element
214 inline const Vector3 copySignPerElem( const Vector3 & vec0, const Vector3 & vec1 );
216 // Maximum of two 3-D vectors per element
218 inline const Vector3 maxPerElem( const Vector3 & vec0, const Vector3 & vec1 );
220 // Minimum of two 3-D vectors per element
222 inline const Vector3 minPerElem( const Vector3 & vec0, const Vector3 & vec1 );
224 // Maximum element of a 3-D vector
226 inline float maxElem( const Vector3 & vec );
228 // Minimum element of a 3-D vector
230 inline float minElem( const Vector3 & vec );
232 // Compute the sum of all elements of a 3-D vector
234 inline float sum( const Vector3 & vec );
236 // Compute the dot product of two 3-D vectors
238 inline float dot( const Vector3 & vec0, const Vector3 & vec1 );
240 // Compute the square of the length of a 3-D vector
242 inline float lengthSqr( const Vector3 & vec );
244 // Compute the length of a 3-D vector
246 inline float length( const Vector3 & vec );
248 // Normalize a 3-D vector
250 // The result is unpredictable when all elements of vec are at or near zero.
252 inline const Vector3 normalize( const Vector3 & vec );
254 // Compute cross product of two 3-D vectors
256 inline const Vector3 cross( const Vector3 & vec0, const Vector3 & vec1 );
258 // Outer product of two 3-D vectors
260 inline const Matrix3 outer( const Vector3 & vec0, const Vector3 & vec1 );
262 // Pre-multiply a row vector by a 3x3 matrix
264 inline const Vector3 rowMul( const Vector3 & vec, const Matrix3 & mat );
266 // Cross-product matrix of a 3-D vector
268 inline const Matrix3 crossMatrix( const Vector3 & vec );
270 // Create cross-product matrix and multiply
272 // Faster than separately creating a cross-product matrix and multiplying.
274 inline const Matrix3 crossMatrixMul( const Vector3 & vec, const Matrix3 & mat );
276 // Linear interpolation between two 3-D vectors
278 // Does not clamp t between 0 and 1.
280 inline const Vector3 lerp( float t, const Vector3 & vec0, const Vector3 & vec1 );
282 // Spherical linear interpolation between two 3-D vectors
284 // The result is unpredictable if the vectors point in opposite directions.
285 // Does not clamp t between 0 and 1.
287 inline const Vector3 slerp( float t, const Vector3 & unitVec0, const Vector3 & unitVec1 );
289 // Conditionally select between two 3-D vectors
291 inline const Vector3 select( const Vector3 & vec0, const Vector3 & vec1, bool select1 );
293 // Load x, y, and z elements from the first three words of a float array.
296 inline void loadXYZ( Vector3 & vec, const float * fptr );
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
301 inline void storeXYZ( const Vector3 & vec, float * fptr );
303 // Load three-half-floats as a 3-D vector
305 // This transformation does not support either denormalized numbers or NaNs.
307 inline void loadHalfFloats( Vector3 & vec, const unsigned short * hfptr );
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.
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.
313 inline void storeHalfFloats( const Vector3 & vec, unsigned short * hfptr );
315 #ifdef _VECTORMATH_DEBUG
317 // Print a 3-D vector
319 // Function is only defined when _VECTORMATH_DEBUG is defined.
321 inline void print( const Vector3 & vec );
323 // Print a 3-D vector and an associated string identifier
325 // Function is only defined when _VECTORMATH_DEBUG is defined.
327 inline void print( const Vector3 & vec, const char * name );
331 // A 4-D vector in array-of-structures format
341 // Default constructor; does no initialization
343 inline Vector4( ) { };
347 inline Vector4( const Vector4 & vec );
349 // Construct a 4-D vector from x, y, z, and w elements
351 inline Vector4( float x, float y, float z, float w );
353 // Construct a 4-D vector from a 3-D vector and a scalar
355 inline Vector4( const Vector3 & xyz, float w );
357 // Copy x, y, and z from a 3-D vector into a 4-D vector, and set w to 0
359 explicit inline Vector4( const Vector3 & vec );
361 // Copy x, y, and z from a 3-D point into a 4-D vector, and set w to 1
363 explicit inline Vector4( const Point3 & pnt );
365 // Copy elements from a quaternion into a 4-D vector
367 explicit inline Vector4( const Quat & quat );
369 // Set all elements of a 4-D vector to the same scalar value
371 explicit inline Vector4( float scalar );
373 // Assign one 4-D vector to another
375 inline Vector4 & operator =( const Vector4 & vec );
377 // Set the x, y, and z elements of a 4-D vector
379 // This function does not change the w element.
381 inline Vector4 & setXYZ( const Vector3 & vec );
383 // Get the x, y, and z elements of a 4-D vector
385 inline const Vector3 getXYZ( ) const;
387 // Set the x element of a 4-D vector
389 inline Vector4 & setX( float x );
391 // Set the y element of a 4-D vector
393 inline Vector4 & setY( float y );
395 // Set the z element of a 4-D vector
397 inline Vector4 & setZ( float z );
399 // Set the w element of a 4-D vector
401 inline Vector4 & setW( float w );
403 // Get the x element of a 4-D vector
405 inline float getX( ) const;
407 // Get the y element of a 4-D vector
409 inline float getY( ) const;
411 // Get the z element of a 4-D vector
413 inline float getZ( ) const;
415 // Get the w element of a 4-D vector
417 inline float getW( ) const;
419 // Set an x, y, z, or w element of a 4-D vector by index
421 inline Vector4 & setElem( int idx, float value );
423 // Get an x, y, z, or w element of a 4-D vector by index
425 inline float getElem( int idx ) const;
427 // Subscripting operator to set or get an element
429 inline float & operator []( int idx );
431 // Subscripting operator to get an element
433 inline float operator []( int idx ) const;
435 // Add two 4-D vectors
437 inline const Vector4 operator +( const Vector4 & vec ) const;
439 // Subtract a 4-D vector from another 4-D vector
441 inline const Vector4 operator -( const Vector4 & vec ) const;
443 // Multiply a 4-D vector by a scalar
445 inline const Vector4 operator *( float scalar ) const;
447 // Divide a 4-D vector by a scalar
449 inline const Vector4 operator /( float scalar ) const;
451 // Perform compound assignment and addition with a 4-D vector
453 inline Vector4 & operator +=( const Vector4 & vec );
455 // Perform compound assignment and subtraction by a 4-D vector
457 inline Vector4 & operator -=( const Vector4 & vec );
459 // Perform compound assignment and multiplication by a scalar
461 inline Vector4 & operator *=( float scalar );
463 // Perform compound assignment and division by a scalar
465 inline Vector4 & operator /=( float scalar );
467 // Negate all elements of a 4-D vector
469 inline const Vector4 operator -( ) const;
473 static inline const Vector4 xAxis( );
477 static inline const Vector4 yAxis( );
481 static inline const Vector4 zAxis( );
485 static inline const Vector4 wAxis( );
489 __attribute__ ((aligned(16)))
493 // Multiply a 4-D vector by a scalar
495 inline const Vector4 operator *( float scalar, const Vector4 & vec );
497 // Multiply two 4-D vectors per element
499 inline const Vector4 mulPerElem( const Vector4 & vec0, const Vector4 & vec1 );
501 // Divide two 4-D vectors per element
503 // Floating-point behavior matches standard library function divf4.
505 inline const Vector4 divPerElem( const Vector4 & vec0, const Vector4 & vec1 );
507 // Compute the reciprocal of a 4-D vector per element
509 // Floating-point behavior matches standard library function recipf4.
511 inline const Vector4 recipPerElem( const Vector4 & vec );
513 // Compute the square root of a 4-D vector per element
515 // Floating-point behavior matches standard library function sqrtf4.
517 inline const Vector4 sqrtPerElem( const Vector4 & vec );
519 // Compute the reciprocal square root of a 4-D vector per element
521 // Floating-point behavior matches standard library function rsqrtf4.
523 inline const Vector4 rsqrtPerElem( const Vector4 & vec );
525 // Compute the absolute value of a 4-D vector per element
527 inline const Vector4 absPerElem( const Vector4 & vec );
529 // Copy sign from one 4-D vector to another, per element
531 inline const Vector4 copySignPerElem( const Vector4 & vec0, const Vector4 & vec1 );
533 // Maximum of two 4-D vectors per element
535 inline const Vector4 maxPerElem( const Vector4 & vec0, const Vector4 & vec1 );
537 // Minimum of two 4-D vectors per element
539 inline const Vector4 minPerElem( const Vector4 & vec0, const Vector4 & vec1 );
541 // Maximum element of a 4-D vector
543 inline float maxElem( const Vector4 & vec );
545 // Minimum element of a 4-D vector
547 inline float minElem( const Vector4 & vec );
549 // Compute the sum of all elements of a 4-D vector
551 inline float sum( const Vector4 & vec );
553 // Compute the dot product of two 4-D vectors
555 inline float dot( const Vector4 & vec0, const Vector4 & vec1 );
557 // Compute the square of the length of a 4-D vector
559 inline float lengthSqr( const Vector4 & vec );
561 // Compute the length of a 4-D vector
563 inline float length( const Vector4 & vec );
565 // Normalize a 4-D vector
567 // The result is unpredictable when all elements of vec are at or near zero.
569 inline const Vector4 normalize( const Vector4 & vec );
571 // Outer product of two 4-D vectors
573 inline const Matrix4 outer( const Vector4 & vec0, const Vector4 & vec1 );
575 // Linear interpolation between two 4-D vectors
577 // Does not clamp t between 0 and 1.
579 inline const Vector4 lerp( float t, const Vector4 & vec0, const Vector4 & vec1 );
581 // Spherical linear interpolation between two 4-D vectors
583 // The result is unpredictable if the vectors point in opposite directions.
584 // Does not clamp t between 0 and 1.
586 inline const Vector4 slerp( float t, const Vector4 & unitVec0, const Vector4 & unitVec1 );
588 // Conditionally select between two 4-D vectors
590 inline const Vector4 select( const Vector4 & vec0, const Vector4 & vec1, bool select1 );
592 // Load x, y, z, and w elements from the first four words of a float array.
595 inline void loadXYZW( Vector4 & vec, const float * fptr );
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
600 inline void storeXYZW( const Vector4 & vec, float * fptr );
602 // Load four-half-floats as a 4-D vector
604 // This transformation does not support either denormalized numbers or NaNs.
606 inline void loadHalfFloats( Vector4 & vec, const unsigned short * hfptr );
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.
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.
612 inline void storeHalfFloats( const Vector4 & vec, unsigned short * hfptr );
614 #ifdef _VECTORMATH_DEBUG
616 // Print a 4-D vector
618 // Function is only defined when _VECTORMATH_DEBUG is defined.
620 inline void print( const Vector4 & vec );
622 // Print a 4-D vector and an associated string identifier
624 // Function is only defined when _VECTORMATH_DEBUG is defined.
626 inline void print( const Vector4 & vec, const char * name );
630 // A 3-D point in array-of-structures format
642 // Default constructor; does no initialization
644 inline Point3( ) { };
648 inline Point3( const Point3 & pnt );
650 // Construct a 3-D point from x, y, and z elements
652 inline Point3( float x, float y, float z );
654 // Copy elements from a 3-D vector into a 3-D point
656 explicit inline Point3( const Vector3 & vec );
658 // Set all elements of a 3-D point to the same scalar value
660 explicit inline Point3( float scalar );
662 // Assign one 3-D point to another
664 inline Point3 & operator =( const Point3 & pnt );
666 // Set the x element of a 3-D point
668 inline Point3 & setX( float x );
670 // Set the y element of a 3-D point
672 inline Point3 & setY( float y );
674 // Set the z element of a 3-D point
676 inline Point3 & setZ( float z );
678 // Get the x element of a 3-D point
680 inline float getX( ) const;
682 // Get the y element of a 3-D point
684 inline float getY( ) const;
686 // Get the z element of a 3-D point
688 inline float getZ( ) const;
690 // Set an x, y, or z element of a 3-D point by index
692 inline Point3 & setElem( int idx, float value );
694 // Get an x, y, or z element of a 3-D point by index
696 inline float getElem( int idx ) const;
698 // Subscripting operator to set or get an element
700 inline float & operator []( int idx );
702 // Subscripting operator to get an element
704 inline float operator []( int idx ) const;
706 // Subtract a 3-D point from another 3-D point
708 inline const Vector3 operator -( const Point3 & pnt ) const;
710 // Add a 3-D point to a 3-D vector
712 inline const Point3 operator +( const Vector3 & vec ) const;
714 // Subtract a 3-D vector from a 3-D point
716 inline const Point3 operator -( const Vector3 & vec ) const;
718 // Perform compound assignment and addition with a 3-D vector
720 inline Point3 & operator +=( const Vector3 & vec );
722 // Perform compound assignment and subtraction by a 3-D vector
724 inline Point3 & operator -=( const Vector3 & vec );
728 __attribute__ ((aligned(16)))
732 // Multiply two 3-D points per element
734 inline const Point3 mulPerElem( const Point3 & pnt0, const Point3 & pnt1 );
736 // Divide two 3-D points per element
738 // Floating-point behavior matches standard library function divf4.
740 inline const Point3 divPerElem( const Point3 & pnt0, const Point3 & pnt1 );
742 // Compute the reciprocal of a 3-D point per element
744 // Floating-point behavior matches standard library function recipf4.
746 inline const Point3 recipPerElem( const Point3 & pnt );
748 // Compute the square root of a 3-D point per element
750 // Floating-point behavior matches standard library function sqrtf4.
752 inline const Point3 sqrtPerElem( const Point3 & pnt );
754 // Compute the reciprocal square root of a 3-D point per element
756 // Floating-point behavior matches standard library function rsqrtf4.
758 inline const Point3 rsqrtPerElem( const Point3 & pnt );
760 // Compute the absolute value of a 3-D point per element
762 inline const Point3 absPerElem( const Point3 & pnt );
764 // Copy sign from one 3-D point to another, per element
766 inline const Point3 copySignPerElem( const Point3 & pnt0, const Point3 & pnt1 );
768 // Maximum of two 3-D points per element
770 inline const Point3 maxPerElem( const Point3 & pnt0, const Point3 & pnt1 );
772 // Minimum of two 3-D points per element
774 inline const Point3 minPerElem( const Point3 & pnt0, const Point3 & pnt1 );
776 // Maximum element of a 3-D point
778 inline float maxElem( const Point3 & pnt );
780 // Minimum element of a 3-D point
782 inline float minElem( const Point3 & pnt );
784 // Compute the sum of all elements of a 3-D point
786 inline float sum( const Point3 & pnt );
788 // Apply uniform scale to a 3-D point
790 inline const Point3 scale( const Point3 & pnt, float scaleVal );
792 // Apply non-uniform scale to a 3-D point
794 inline const Point3 scale( const Point3 & pnt, const Vector3 & scaleVec );
796 // Scalar projection of a 3-D point on a unit-length 3-D vector
798 inline float projection( const Point3 & pnt, const Vector3 & unitVec );
800 // Compute the square of the distance of a 3-D point from the coordinate-system origin
802 inline float distSqrFromOrigin( const Point3 & pnt );
804 // Compute the distance of a 3-D point from the coordinate-system origin
806 inline float distFromOrigin( const Point3 & pnt );
808 // Compute the square of the distance between two 3-D points
810 inline float distSqr( const Point3 & pnt0, const Point3 & pnt1 );
812 // Compute the distance between two 3-D points
814 inline float dist( const Point3 & pnt0, const Point3 & pnt1 );
816 // Linear interpolation between two 3-D points
818 // Does not clamp t between 0 and 1.
820 inline const Point3 lerp( float t, const Point3 & pnt0, const Point3 & pnt1 );
822 // Conditionally select between two 3-D points
824 inline const Point3 select( const Point3 & pnt0, const Point3 & pnt1, bool select1 );
826 // Load x, y, and z elements from the first three words of a float array.
829 inline void loadXYZ( Point3 & pnt, const float * fptr );
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
834 inline void storeXYZ( const Point3 & pnt, float * fptr );
836 // Load three-half-floats as a 3-D point
838 // This transformation does not support either denormalized numbers or NaNs.
840 inline void loadHalfFloats( Point3 & pnt, const unsigned short * hfptr );
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.
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.
846 inline void storeHalfFloats( const Point3 & pnt, unsigned short * hfptr );
848 #ifdef _VECTORMATH_DEBUG
852 // Function is only defined when _VECTORMATH_DEBUG is defined.
854 inline void print( const Point3 & pnt );
856 // Print a 3-D point and an associated string identifier
858 // Function is only defined when _VECTORMATH_DEBUG is defined.
860 inline void print( const Point3 & pnt, const char * name );
864 // A quaternion in array-of-structures format
874 // Default constructor; does no initialization
880 inline Quat( const Quat & quat );
882 // Construct a quaternion from x, y, z, and w elements
884 inline Quat( float x, float y, float z, float w );
886 // Construct a quaternion from a 3-D vector and a scalar
888 inline Quat( const Vector3 & xyz, float w );
890 // Copy elements from a 4-D vector into a quaternion
892 explicit inline Quat( const Vector4 & vec );
894 // Convert a rotation matrix to a unit-length quaternion
896 explicit inline Quat( const Matrix3 & rotMat );
898 // Set all elements of a quaternion to the same scalar value
900 explicit inline Quat( float scalar );
902 // Assign one quaternion to another
904 inline Quat & operator =( const Quat & quat );
906 // Set the x, y, and z elements of a quaternion
908 // This function does not change the w element.
910 inline Quat & setXYZ( const Vector3 & vec );
912 // Get the x, y, and z elements of a quaternion
914 inline const Vector3 getXYZ( ) const;
916 // Set the x element of a quaternion
918 inline Quat & setX( float x );
920 // Set the y element of a quaternion
922 inline Quat & setY( float y );
924 // Set the z element of a quaternion
926 inline Quat & setZ( float z );
928 // Set the w element of a quaternion
930 inline Quat & setW( float w );
932 // Get the x element of a quaternion
934 inline float getX( ) const;
936 // Get the y element of a quaternion
938 inline float getY( ) const;
940 // Get the z element of a quaternion
942 inline float getZ( ) const;
944 // Get the w element of a quaternion
946 inline float getW( ) const;
948 // Set an x, y, z, or w element of a quaternion by index
950 inline Quat & setElem( int idx, float value );
952 // Get an x, y, z, or w element of a quaternion by index
954 inline float getElem( int idx ) const;
956 // Subscripting operator to set or get an element
958 inline float & operator []( int idx );
960 // Subscripting operator to get an element
962 inline float operator []( int idx ) const;
964 // Add two quaternions
966 inline const Quat operator +( const Quat & quat ) const;
968 // Subtract a quaternion from another quaternion
970 inline const Quat operator -( const Quat & quat ) const;
972 // Multiply two quaternions
974 inline const Quat operator *( const Quat & quat ) const;
976 // Multiply a quaternion by a scalar
978 inline const Quat operator *( float scalar ) const;
980 // Divide a quaternion by a scalar
982 inline const Quat operator /( float scalar ) const;
984 // Perform compound assignment and addition with a quaternion
986 inline Quat & operator +=( const Quat & quat );
988 // Perform compound assignment and subtraction by a quaternion
990 inline Quat & operator -=( const Quat & quat );
992 // Perform compound assignment and multiplication by a quaternion
994 inline Quat & operator *=( const Quat & quat );
996 // Perform compound assignment and multiplication by a scalar
998 inline Quat & operator *=( float scalar );
1000 // Perform compound assignment and division by a scalar
1002 inline Quat & operator /=( float scalar );
1004 // Negate all elements of a quaternion
1006 inline const Quat operator -( ) const;
1008 // Construct an identity quaternion
1010 static inline const Quat identity( );
1012 // Construct a quaternion to rotate between two unit-length 3-D vectors
1014 // The result is unpredictable if unitVec0 and unitVec1 point in opposite directions.
1016 static inline const Quat rotation( const Vector3 & unitVec0, const Vector3 & unitVec1 );
1018 // Construct a quaternion to rotate around a unit-length 3-D vector
1020 static inline const Quat rotation( float radians, const Vector3 & unitVec );
1022 // Construct a quaternion to rotate around the x axis
1024 static inline const Quat rotationX( float radians );
1026 // Construct a quaternion to rotate around the y axis
1028 static inline const Quat rotationY( float radians );
1030 // Construct a quaternion to rotate around the z axis
1032 static inline const Quat rotationZ( float radians );
1036 __attribute__ ((aligned(16)))
1040 // Multiply a quaternion by a scalar
1042 inline const Quat operator *( float scalar, const Quat & quat );
1044 // Compute the conjugate of a quaternion
1046 inline const Quat conj( const Quat & quat );
1048 // Use a unit-length quaternion to rotate a 3-D vector
1050 inline const Vector3 rotate( const Quat & unitQuat, const Vector3 & vec );
1052 // Compute the dot product of two quaternions
1054 inline float dot( const Quat & quat0, const Quat & quat1 );
1056 // Compute the norm of a quaternion
1058 inline float norm( const Quat & quat );
1060 // Compute the length of a quaternion
1062 inline float length( const Quat & quat );
1064 // Normalize a quaternion
1066 // The result is unpredictable when all elements of quat are at or near zero.
1068 inline const Quat normalize( const Quat & quat );
1070 // Linear interpolation between two quaternions
1072 // Does not clamp t between 0 and 1.
1074 inline const Quat lerp( float t, const Quat & quat0, const Quat & quat1 );
1076 // Spherical linear interpolation between two quaternions
1078 // Interpolates along the shortest path between orientations.
1079 // Does not clamp t between 0 and 1.
1081 inline const Quat slerp( float t, const Quat & unitQuat0, const Quat & unitQuat1 );
1083 // Spherical quadrangle interpolation
1085 inline const Quat squad( float t, const Quat & unitQuat0, const Quat & unitQuat1, const Quat & unitQuat2, const Quat & unitQuat3 );
1087 // Conditionally select between two quaternions
1089 inline const Quat select( const Quat & quat0, const Quat & quat1, bool select1 );
1091 // Load x, y, z, and w elements from the first four words of a float array.
1094 inline void loadXYZW( Quat & quat, const float * fptr );
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
1099 inline void storeXYZW( const Quat & quat, float * fptr );
1101 #ifdef _VECTORMATH_DEBUG
1103 // Print a quaternion
1105 // Function is only defined when _VECTORMATH_DEBUG is defined.
1107 inline void print( const Quat & quat );
1109 // Print a quaternion and an associated string identifier
1111 // Function is only defined when _VECTORMATH_DEBUG is defined.
1113 inline void print( const Quat & quat, const char * name );
1117 // A 3x3 matrix in array-of-structures format
1126 // Default constructor; does no initialization
1128 inline Matrix3( ) { };
1130 // Copy a 3x3 matrix
1132 inline Matrix3( const Matrix3 & mat );
1134 // Construct a 3x3 matrix containing the specified columns
1136 inline Matrix3( const Vector3 & col0, const Vector3 & col1, const Vector3 & col2 );
1138 // Construct a 3x3 rotation matrix from a unit-length quaternion
1140 explicit inline Matrix3( const Quat & unitQuat );
1142 // Set all elements of a 3x3 matrix to the same scalar value
1144 explicit inline Matrix3( float scalar );
1146 // Assign one 3x3 matrix to another
1148 inline Matrix3 & operator =( const Matrix3 & mat );
1150 // Set column 0 of a 3x3 matrix
1152 inline Matrix3 & setCol0( const Vector3 & col0 );
1154 // Set column 1 of a 3x3 matrix
1156 inline Matrix3 & setCol1( const Vector3 & col1 );
1158 // Set column 2 of a 3x3 matrix
1160 inline Matrix3 & setCol2( const Vector3 & col2 );
1162 // Get column 0 of a 3x3 matrix
1164 inline const Vector3 getCol0( ) const;
1166 // Get column 1 of a 3x3 matrix
1168 inline const Vector3 getCol1( ) const;
1170 // Get column 2 of a 3x3 matrix
1172 inline const Vector3 getCol2( ) const;
1174 // Set the column of a 3x3 matrix referred to by the specified index
1176 inline Matrix3 & setCol( int col, const Vector3 & vec );
1178 // Set the row of a 3x3 matrix referred to by the specified index
1180 inline Matrix3 & setRow( int row, const Vector3 & vec );
1182 // Get the column of a 3x3 matrix referred to by the specified index
1184 inline const Vector3 getCol( int col ) const;
1186 // Get the row of a 3x3 matrix referred to by the specified index
1188 inline const Vector3 getRow( int row ) const;
1190 // Subscripting operator to set or get a column
1192 inline Vector3 & operator []( int col );
1194 // Subscripting operator to get a column
1196 inline const Vector3 operator []( int col ) const;
1198 // Set the element of a 3x3 matrix referred to by column and row indices
1200 inline Matrix3 & setElem( int col, int row, float val );
1202 // Get the element of a 3x3 matrix referred to by column and row indices
1204 inline float getElem( int col, int row ) const;
1206 // Add two 3x3 matrices
1208 inline const Matrix3 operator +( const Matrix3 & mat ) const;
1210 // Subtract a 3x3 matrix from another 3x3 matrix
1212 inline const Matrix3 operator -( const Matrix3 & mat ) const;
1214 // Negate all elements of a 3x3 matrix
1216 inline const Matrix3 operator -( ) const;
1218 // Multiply a 3x3 matrix by a scalar
1220 inline const Matrix3 operator *( float scalar ) const;
1222 // Multiply a 3x3 matrix by a 3-D vector
1224 inline const Vector3 operator *( const Vector3 & vec ) const;
1226 // Multiply two 3x3 matrices
1228 inline const Matrix3 operator *( const Matrix3 & mat ) const;
1230 // Perform compound assignment and addition with a 3x3 matrix
1232 inline Matrix3 & operator +=( const Matrix3 & mat );
1234 // Perform compound assignment and subtraction by a 3x3 matrix
1236 inline Matrix3 & operator -=( const Matrix3 & mat );
1238 // Perform compound assignment and multiplication by a scalar
1240 inline Matrix3 & operator *=( float scalar );
1242 // Perform compound assignment and multiplication by a 3x3 matrix
1244 inline Matrix3 & operator *=( const Matrix3 & mat );
1246 // Construct an identity 3x3 matrix
1248 static inline const Matrix3 identity( );
1250 // Construct a 3x3 matrix to rotate around the x axis
1252 static inline const Matrix3 rotationX( float radians );
1254 // Construct a 3x3 matrix to rotate around the y axis
1256 static inline const Matrix3 rotationY( float radians );
1258 // Construct a 3x3 matrix to rotate around the z axis
1260 static inline const Matrix3 rotationZ( float radians );
1262 // Construct a 3x3 matrix to rotate around the x, y, and z axes
1264 static inline const Matrix3 rotationZYX( const Vector3 & radiansXYZ );
1266 // Construct a 3x3 matrix to rotate around a unit-length 3-D vector
1268 static inline const Matrix3 rotation( float radians, const Vector3 & unitVec );
1270 // Construct a rotation matrix from a unit-length quaternion
1272 static inline const Matrix3 rotation( const Quat & unitQuat );
1274 // Construct a 3x3 matrix to perform scaling
1276 static inline const Matrix3 scale( const Vector3 & scaleVec );
1279 // Multiply a 3x3 matrix by a scalar
1281 inline const Matrix3 operator *( float scalar, const Matrix3 & mat );
1283 // Append (post-multiply) a scale transformation to a 3x3 matrix
1285 // Faster than creating and multiplying a scale transformation matrix.
1287 inline const Matrix3 appendScale( const Matrix3 & mat, const Vector3 & scaleVec );
1289 // Prepend (pre-multiply) a scale transformation to a 3x3 matrix
1291 // Faster than creating and multiplying a scale transformation matrix.
1293 inline const Matrix3 prependScale( const Vector3 & scaleVec, const Matrix3 & mat );
1295 // Multiply two 3x3 matrices per element
1297 inline const Matrix3 mulPerElem( const Matrix3 & mat0, const Matrix3 & mat1 );
1299 // Compute the absolute value of a 3x3 matrix per element
1301 inline const Matrix3 absPerElem( const Matrix3 & mat );
1303 // Transpose of a 3x3 matrix
1305 inline const Matrix3 transpose( const Matrix3 & mat );
1307 // Compute the inverse of a 3x3 matrix
1309 // Result is unpredictable when the determinant of mat is equal to or near 0.
1311 inline const Matrix3 inverse( const Matrix3 & mat );
1313 // Determinant of a 3x3 matrix
1315 inline float determinant( const Matrix3 & mat );
1317 // Conditionally select between two 3x3 matrices
1319 inline const Matrix3 select( const Matrix3 & mat0, const Matrix3 & mat1, bool select1 );
1321 #ifdef _VECTORMATH_DEBUG
1323 // Print a 3x3 matrix
1325 // Function is only defined when _VECTORMATH_DEBUG is defined.
1327 inline void print( const Matrix3 & mat );
1329 // Print a 3x3 matrix and an associated string identifier
1331 // Function is only defined when _VECTORMATH_DEBUG is defined.
1333 inline void print( const Matrix3 & mat, const char * name );
1337 // A 4x4 matrix in array-of-structures format
1347 // Default constructor; does no initialization
1349 inline Matrix4( ) { };
1351 // Copy a 4x4 matrix
1353 inline Matrix4( const Matrix4 & mat );
1355 // Construct a 4x4 matrix containing the specified columns
1357 inline Matrix4( const Vector4 & col0, const Vector4 & col1, const Vector4 & col2, const Vector4 & col3 );
1359 // Construct a 4x4 matrix from a 3x4 transformation matrix
1361 explicit inline Matrix4( const Transform3 & mat );
1363 // Construct a 4x4 matrix from a 3x3 matrix and a 3-D vector
1365 inline Matrix4( const Matrix3 & mat, const Vector3 & translateVec );
1367 // Construct a 4x4 matrix from a unit-length quaternion and a 3-D vector
1369 inline Matrix4( const Quat & unitQuat, const Vector3 & translateVec );
1371 // Set all elements of a 4x4 matrix to the same scalar value
1373 explicit inline Matrix4( float scalar );
1375 // Assign one 4x4 matrix to another
1377 inline Matrix4 & operator =( const Matrix4 & mat );
1379 // Set the upper-left 3x3 submatrix
1381 // This function does not change the bottom row elements.
1383 inline Matrix4 & setUpper3x3( const Matrix3 & mat3 );
1385 // Get the upper-left 3x3 submatrix of a 4x4 matrix
1387 inline const Matrix3 getUpper3x3( ) const;
1389 // Set translation component
1391 // This function does not change the bottom row elements.
1393 inline Matrix4 & setTranslation( const Vector3 & translateVec );
1395 // Get the translation component of a 4x4 matrix
1397 inline const Vector3 getTranslation( ) const;
1399 // Set column 0 of a 4x4 matrix
1401 inline Matrix4 & setCol0( const Vector4 & col0 );
1403 // Set column 1 of a 4x4 matrix
1405 inline Matrix4 & setCol1( const Vector4 & col1 );
1407 // Set column 2 of a 4x4 matrix
1409 inline Matrix4 & setCol2( const Vector4 & col2 );
1411 // Set column 3 of a 4x4 matrix
1413 inline Matrix4 & setCol3( const Vector4 & col3 );
1415 // Get column 0 of a 4x4 matrix
1417 inline const Vector4 getCol0( ) const;
1419 // Get column 1 of a 4x4 matrix
1421 inline const Vector4 getCol1( ) const;
1423 // Get column 2 of a 4x4 matrix
1425 inline const Vector4 getCol2( ) const;
1427 // Get column 3 of a 4x4 matrix
1429 inline const Vector4 getCol3( ) const;
1431 // Set the column of a 4x4 matrix referred to by the specified index
1433 inline Matrix4 & setCol( int col, const Vector4 & vec );
1435 // Set the row of a 4x4 matrix referred to by the specified index
1437 inline Matrix4 & setRow( int row, const Vector4 & vec );
1439 // Get the column of a 4x4 matrix referred to by the specified index
1441 inline const Vector4 getCol( int col ) const;
1443 // Get the row of a 4x4 matrix referred to by the specified index
1445 inline const Vector4 getRow( int row ) const;
1447 // Subscripting operator to set or get a column
1449 inline Vector4 & operator []( int col );
1451 // Subscripting operator to get a column
1453 inline const Vector4 operator []( int col ) const;
1455 // Set the element of a 4x4 matrix referred to by column and row indices
1457 inline Matrix4 & setElem( int col, int row, float val );
1459 // Get the element of a 4x4 matrix referred to by column and row indices
1461 inline float getElem( int col, int row ) const;
1463 // Add two 4x4 matrices
1465 inline const Matrix4 operator +( const Matrix4 & mat ) const;
1467 // Subtract a 4x4 matrix from another 4x4 matrix
1469 inline const Matrix4 operator -( const Matrix4 & mat ) const;
1471 // Negate all elements of a 4x4 matrix
1473 inline const Matrix4 operator -( ) const;
1475 // Multiply a 4x4 matrix by a scalar
1477 inline const Matrix4 operator *( float scalar ) const;
1479 // Multiply a 4x4 matrix by a 4-D vector
1481 inline const Vector4 operator *( const Vector4 & vec ) const;
1483 // Multiply a 4x4 matrix by a 3-D vector
1485 inline const Vector4 operator *( const Vector3 & vec ) const;
1487 // Multiply a 4x4 matrix by a 3-D point
1489 inline const Vector4 operator *( const Point3 & pnt ) const;
1491 // Multiply two 4x4 matrices
1493 inline const Matrix4 operator *( const Matrix4 & mat ) const;
1495 // Multiply a 4x4 matrix by a 3x4 transformation matrix
1497 inline const Matrix4 operator *( const Transform3 & tfrm ) const;
1499 // Perform compound assignment and addition with a 4x4 matrix
1501 inline Matrix4 & operator +=( const Matrix4 & mat );
1503 // Perform compound assignment and subtraction by a 4x4 matrix
1505 inline Matrix4 & operator -=( const Matrix4 & mat );
1507 // Perform compound assignment and multiplication by a scalar
1509 inline Matrix4 & operator *=( float scalar );
1511 // Perform compound assignment and multiplication by a 4x4 matrix
1513 inline Matrix4 & operator *=( const Matrix4 & mat );
1515 // Perform compound assignment and multiplication by a 3x4 transformation matrix
1517 inline Matrix4 & operator *=( const Transform3 & tfrm );
1519 // Construct an identity 4x4 matrix
1521 static inline const Matrix4 identity( );
1523 // Construct a 4x4 matrix to rotate around the x axis
1525 static inline const Matrix4 rotationX( float radians );
1527 // Construct a 4x4 matrix to rotate around the y axis
1529 static inline const Matrix4 rotationY( float radians );
1531 // Construct a 4x4 matrix to rotate around the z axis
1533 static inline const Matrix4 rotationZ( float radians );
1535 // Construct a 4x4 matrix to rotate around the x, y, and z axes
1537 static inline const Matrix4 rotationZYX( const Vector3 & radiansXYZ );
1539 // Construct a 4x4 matrix to rotate around a unit-length 3-D vector
1541 static inline const Matrix4 rotation( float radians, const Vector3 & unitVec );
1543 // Construct a rotation matrix from a unit-length quaternion
1545 static inline const Matrix4 rotation( const Quat & unitQuat );
1547 // Construct a 4x4 matrix to perform scaling
1549 static inline const Matrix4 scale( const Vector3 & scaleVec );
1551 // Construct a 4x4 matrix to perform translation
1553 static inline const Matrix4 translation( const Vector3 & translateVec );
1555 // Construct viewing matrix based on eye position, position looked at, and up direction
1557 static inline const Matrix4 lookAt( const Point3 & eyePos, const Point3 & lookAtPos, const Vector3 & upVec );
1559 // Construct a perspective projection matrix
1561 static inline const Matrix4 perspective( float fovyRadians, float aspect, float zNear, float zFar );
1563 // Construct a perspective projection matrix based on frustum
1565 static inline const Matrix4 frustum( float left, float right, float bottom, float top, float zNear, float zFar );
1567 // Construct an orthographic projection matrix
1569 static inline const Matrix4 orthographic( float left, float right, float bottom, float top, float zNear, float zFar );
1572 // Multiply a 4x4 matrix by a scalar
1574 inline const Matrix4 operator *( float scalar, const Matrix4 & mat );
1576 // Append (post-multiply) a scale transformation to a 4x4 matrix
1578 // Faster than creating and multiplying a scale transformation matrix.
1580 inline const Matrix4 appendScale( const Matrix4 & mat, const Vector3 & scaleVec );
1582 // Prepend (pre-multiply) a scale transformation to a 4x4 matrix
1584 // Faster than creating and multiplying a scale transformation matrix.
1586 inline const Matrix4 prependScale( const Vector3 & scaleVec, const Matrix4 & mat );
1588 // Multiply two 4x4 matrices per element
1590 inline const Matrix4 mulPerElem( const Matrix4 & mat0, const Matrix4 & mat1 );
1592 // Compute the absolute value of a 4x4 matrix per element
1594 inline const Matrix4 absPerElem( const Matrix4 & mat );
1596 // Transpose of a 4x4 matrix
1598 inline const Matrix4 transpose( const Matrix4 & mat );
1600 // Compute the inverse of a 4x4 matrix
1602 // Result is unpredictable when the determinant of mat is equal to or near 0.
1604 inline const Matrix4 inverse( const Matrix4 & mat );
1606 // Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix
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.
1610 inline const Matrix4 affineInverse( const Matrix4 & mat );
1612 // Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix with an orthogonal upper-left 3x3 submatrix
1614 // This can be used to achieve better performance than a general inverse when the specified 4x4 matrix meets the given restrictions.
1616 inline const Matrix4 orthoInverse( const Matrix4 & mat );
1618 // Determinant of a 4x4 matrix
1620 inline float determinant( const Matrix4 & mat );
1622 // Conditionally select between two 4x4 matrices
1624 inline const Matrix4 select( const Matrix4 & mat0, const Matrix4 & mat1, bool select1 );
1626 #ifdef _VECTORMATH_DEBUG
1628 // Print a 4x4 matrix
1630 // Function is only defined when _VECTORMATH_DEBUG is defined.
1632 inline void print( const Matrix4 & mat );
1634 // Print a 4x4 matrix and an associated string identifier
1636 // Function is only defined when _VECTORMATH_DEBUG is defined.
1638 inline void print( const Matrix4 & mat, const char * name );
1642 // A 3x4 transformation matrix in array-of-structures format
1652 // Default constructor; does no initialization
1654 inline Transform3( ) { };
1656 // Copy a 3x4 transformation matrix
1658 inline Transform3( const Transform3 & tfrm );
1660 // Construct a 3x4 transformation matrix containing the specified columns
1662 inline Transform3( const Vector3 & col0, const Vector3 & col1, const Vector3 & col2, const Vector3 & col3 );
1664 // Construct a 3x4 transformation matrix from a 3x3 matrix and a 3-D vector
1666 inline Transform3( const Matrix3 & tfrm, const Vector3 & translateVec );
1668 // Construct a 3x4 transformation matrix from a unit-length quaternion and a 3-D vector
1670 inline Transform3( const Quat & unitQuat, const Vector3 & translateVec );
1672 // Set all elements of a 3x4 transformation matrix to the same scalar value
1674 explicit inline Transform3( float scalar );
1676 // Assign one 3x4 transformation matrix to another
1678 inline Transform3 & operator =( const Transform3 & tfrm );
1680 // Set the upper-left 3x3 submatrix
1682 inline Transform3 & setUpper3x3( const Matrix3 & mat3 );
1684 // Get the upper-left 3x3 submatrix of a 3x4 transformation matrix
1686 inline const Matrix3 getUpper3x3( ) const;
1688 // Set translation component
1690 inline Transform3 & setTranslation( const Vector3 & translateVec );
1692 // Get the translation component of a 3x4 transformation matrix
1694 inline const Vector3 getTranslation( ) const;
1696 // Set column 0 of a 3x4 transformation matrix
1698 inline Transform3 & setCol0( const Vector3 & col0 );
1700 // Set column 1 of a 3x4 transformation matrix
1702 inline Transform3 & setCol1( const Vector3 & col1 );
1704 // Set column 2 of a 3x4 transformation matrix
1706 inline Transform3 & setCol2( const Vector3 & col2 );
1708 // Set column 3 of a 3x4 transformation matrix
1710 inline Transform3 & setCol3( const Vector3 & col3 );
1712 // Get column 0 of a 3x4 transformation matrix
1714 inline const Vector3 getCol0( ) const;
1716 // Get column 1 of a 3x4 transformation matrix
1718 inline const Vector3 getCol1( ) const;
1720 // Get column 2 of a 3x4 transformation matrix
1722 inline const Vector3 getCol2( ) const;
1724 // Get column 3 of a 3x4 transformation matrix
1726 inline const Vector3 getCol3( ) const;
1728 // Set the column of a 3x4 transformation matrix referred to by the specified index
1730 inline Transform3 & setCol( int col, const Vector3 & vec );
1732 // Set the row of a 3x4 transformation matrix referred to by the specified index
1734 inline Transform3 & setRow( int row, const Vector4 & vec );
1736 // Get the column of a 3x4 transformation matrix referred to by the specified index
1738 inline const Vector3 getCol( int col ) const;
1740 // Get the row of a 3x4 transformation matrix referred to by the specified index
1742 inline const Vector4 getRow( int row ) const;
1744 // Subscripting operator to set or get a column
1746 inline Vector3 & operator []( int col );
1748 // Subscripting operator to get a column
1750 inline const Vector3 operator []( int col ) const;
1752 // Set the element of a 3x4 transformation matrix referred to by column and row indices
1754 inline Transform3 & setElem( int col, int row, float val );
1756 // Get the element of a 3x4 transformation matrix referred to by column and row indices
1758 inline float getElem( int col, int row ) const;
1760 // Multiply a 3x4 transformation matrix by a 3-D vector
1762 inline const Vector3 operator *( const Vector3 & vec ) const;
1764 // Multiply a 3x4 transformation matrix by a 3-D point
1766 inline const Point3 operator *( const Point3 & pnt ) const;
1768 // Multiply two 3x4 transformation matrices
1770 inline const Transform3 operator *( const Transform3 & tfrm ) const;
1772 // Perform compound assignment and multiplication by a 3x4 transformation matrix
1774 inline Transform3 & operator *=( const Transform3 & tfrm );
1776 // Construct an identity 3x4 transformation matrix
1778 static inline const Transform3 identity( );
1780 // Construct a 3x4 transformation matrix to rotate around the x axis
1782 static inline const Transform3 rotationX( float radians );
1784 // Construct a 3x4 transformation matrix to rotate around the y axis
1786 static inline const Transform3 rotationY( float radians );
1788 // Construct a 3x4 transformation matrix to rotate around the z axis
1790 static inline const Transform3 rotationZ( float radians );
1792 // Construct a 3x4 transformation matrix to rotate around the x, y, and z axes
1794 static inline const Transform3 rotationZYX( const Vector3 & radiansXYZ );
1796 // Construct a 3x4 transformation matrix to rotate around a unit-length 3-D vector
1798 static inline const Transform3 rotation( float radians, const Vector3 & unitVec );
1800 // Construct a rotation matrix from a unit-length quaternion
1802 static inline const Transform3 rotation( const Quat & unitQuat );
1804 // Construct a 3x4 transformation matrix to perform scaling
1806 static inline const Transform3 scale( const Vector3 & scaleVec );
1808 // Construct a 3x4 transformation matrix to perform translation
1810 static inline const Transform3 translation( const Vector3 & translateVec );
1813 // Append (post-multiply) a scale transformation to a 3x4 transformation matrix
1815 // Faster than creating and multiplying a scale transformation matrix.
1817 inline const Transform3 appendScale( const Transform3 & tfrm, const Vector3 & scaleVec );
1819 // Prepend (pre-multiply) a scale transformation to a 3x4 transformation matrix
1821 // Faster than creating and multiplying a scale transformation matrix.
1823 inline const Transform3 prependScale( const Vector3 & scaleVec, const Transform3 & tfrm );
1825 // Multiply two 3x4 transformation matrices per element
1827 inline const Transform3 mulPerElem( const Transform3 & tfrm0, const Transform3 & tfrm1 );
1829 // Compute the absolute value of a 3x4 transformation matrix per element
1831 inline const Transform3 absPerElem( const Transform3 & tfrm );
1833 // Inverse of a 3x4 transformation matrix
1835 // Result is unpredictable when the determinant of the left 3x3 submatrix is equal to or near 0.
1837 inline const Transform3 inverse( const Transform3 & tfrm );
1839 // Compute the inverse of a 3x4 transformation matrix, expected to have an orthogonal upper-left 3x3 submatrix
1841 // This can be used to achieve better performance than a general inverse when the specified 3x4 transformation matrix meets the given restrictions.
1843 inline const Transform3 orthoInverse( const Transform3 & tfrm );
1845 // Conditionally select between two 3x4 transformation matrices
1847 inline const Transform3 select( const Transform3 & tfrm0, const Transform3 & tfrm1, bool select1 );
1849 #ifdef _VECTORMATH_DEBUG
1851 // Print a 3x4 transformation matrix
1853 // Function is only defined when _VECTORMATH_DEBUG is defined.
1855 inline void print( const Transform3 & tfrm );
1857 // Print a 3x4 transformation matrix and an associated string identifier
1859 // Function is only defined when _VECTORMATH_DEBUG is defined.
1861 inline void print( const Transform3 & tfrm, const char * name );
1866 } // namespace Vectormath
1868 #include "vec_aos.h"
1869 #include "quat_aos.h"
1870 #include "mat_aos.h"