47 struct VECTRAIT<double> {
52 struct VECTRAIT<int32_t> {
56 template<
typename T,
typename Y>
58 static T getX(
const Y &
v ) {
return static_cast<T
>( v.x ); }
59 static T getY(
const Y &
v ) {
return static_cast<T
>( v.y ); }
60 static T getZ(
const Y &
v ) {
return static_cast<T
>( v.z ); }
65 template<
typename T>
class Vec3;
75 typedef typename VECTRAIT<T>::DIST
DIST;
76 static const int DIM = 2;
81 explicit Vec2(
const T *d ) :
x( d[0] ),
y( d[1] ) {}
83 template<
typename FromT>
85 :
x( static_cast<T>( src.
x ) ),
y( static_cast<T>( src.
y ) )
88 void set( T ax, T ay )
99 template<
typename FromT>
102 x =
static_cast<T
>( rhs.
x );
103 y =
static_cast<T
>( rhs.
y );
116 assert( n >= 0 && n <= 1 );
122 assert( n >= 0 && n <= 1 );
126 T*
ptr()
const {
return &(
const_cast<Vec2*
>( this )->
x); }
146 return (
x == rhs.
x ) && (
y == rhs.
y );
151 return ! ( *
this == rhs );
156 return x * rhs.
x +
y * rhs.
y;
162 return x * rhs.
y -
y * rhs.
x;
167 return ( *
this - rhs ).length();
172 return ( *
this - rhs ).lengthSquared();
219 T rx =
x * cosa -
y * sina;
220 y =
x * sina +
y * cosa;
226 return x *
x +
y *
y;
234 if( ( lengthSquared > maxLength * maxLength ) && ( lengthSquared > 0 ) ) {
246 if( ( lengthSquared > maxLength * maxLength ) && ( lengthSquared > 0 ) ) {
248 return Vec2<T>(
x * ratio, y * ratio );
267 return (*
this) + ( r - (*this) ) * fact;
272 x =
x + ( rhs.
x -
x ) * fact;
y = y + ( rhs.
y -
y ) * fact;
305 friend std::ostream& operator<<( std::ostream& lhs, const Vec2<T>& rhs )
307 lhs <<
"[" << rhs.
x <<
"," << rhs.y <<
"]";
329 :
x( nx ),
y( ny ),
z( nz )
332 :
x( src.
x ),
y( src.
y ),
z( src.
z )
335 :
x( v2.
x ),
y( v2.
y ),
z( aZ )
338 :
x( v2.
x ),
y( v2.
y ),
z( 0 )
340 explicit Vec3(
const T *d ) :
x( d[0] ),
y( d[1] ),
z( d[2] ) {}
341 template<
typename FromT>
343 :
x( static_cast<T>( src.
x ) ),
y( static_cast<T>( src.
y ) ),
z( static_cast<T>( src.
z ) )
347 :
x( VEC3CONV<
Vec3<typename T::
TYPE>,Y>::getX( v ) ),
y( VEC3CONV<typename T::
TYPE,Y>::getY( v ) ),
z( VEC3CONV<typename T::
TYPE,Y>::getZ( v ) )
351 void set( T ax, T ay, T az )
353 x = ax;
y = ay;
z = az;
358 x = rhs.x;
y = rhs.y;
z = rhs.z;
369 template<
typename FromT>
372 x =
static_cast<T
>( rhs.x );
373 y =
static_cast<T
>( rhs.y );
374 z =
static_cast<T
>( rhs.z );
380 assert( n >= 0 && n <= 2 );
386 assert( n >= 0 && n <= 2 );
390 T*
ptr()
const {
return &(
const_cast<Vec3*
>( this )->
x); }
410 return (
x == rhs.x ) && (
y == rhs.y ) && (
z == rhs.z );
415 return !( *
this == rhs );
420 return x*rhs.x +
y*rhs.y +
z*rhs.z;
425 return Vec3<T>(
y * rhs.z - rhs.y *
z,
z * rhs.x - rhs.z *
x,
x * rhs.y - rhs.x *
y );
430 return ( *
this - rhs ).length();
435 return ( *
this - rhs ).lengthSquared();
453 if( ( lengthSquared > maxLength * maxLength ) && ( lengthSquared > 0 ) ) {
466 if( ( lengthSquared > maxLength * maxLength ) && ( lengthSquared > 0 ) ) {
468 return Vec3<T>(
x * ratio,
y * ratio, z * ratio );
486 T invS = ((T)1) /
length();
494 T invS = ((T)1) /
length();
495 return Vec3<T>(
x * invS,
y * invS,
z * invS );
515 return Vec3<T>(
x * invS,
y * invS,
z * invS );
534 T ry =
y * cosa -
z * sina;
535 T rz =
y * sina +
z * cosa;
544 T rx =
x * cosa -
z * sina;
545 T rz =
x * sina +
z * cosa;
554 T rx =
x * cosa -
y * sina;
555 T ry =
x * sina +
y * cosa;
565 T rx = (cosa + (1 - cosa) * axis.x * axis.x) *
x;
566 rx += ((1 - cosa) * axis.x * axis.y - axis.z * sina) *
y;
567 rx += ((1 - cosa) * axis.x * axis.z + axis.y * sina) *
z;
569 T ry = ((1 - cosa) * axis.x * axis.y + axis.z * sina) *
x;
570 ry += (cosa + (1 - cosa) * axis.y * axis.y) *
y;
571 ry += ((1 - cosa) * axis.y * axis.z - axis.x * sina) *
z;
573 T rz = ((1 - cosa) * axis.x * axis.z - axis.y * sina) *
x;
574 rz += ((1 - cosa) * axis.y * axis.z + axis.x * sina) *
y;
575 rz += (cosa + (1 - cosa) * axis.z * axis.z) *
z;
584 return (*
this) + (rhs - (*this)) * fact;
589 x =
x + ( rhs.x -
x ) * fact;
y = y + ( rhs.y -
y ) * fact;
z = z + ( rhs.z -
z ) * fact;
599 return Vec3<T>(
static_cast<T
>( 0 ), static_cast<T>( 0 ),
static_cast<T
>( 0 ) );
604 return Vec3<T>(
static_cast<T
>( 1 ), static_cast<T>( 1 ),
static_cast<T
>( 1 ) );
609 T cosAlpha,
alpha, sinAlpha;
614 cosAlpha = this->
dot( r );
627 return *
this * t1 + r * t2;
634 Vec3<T> r2 = tangentA.slerp( t, tangentB );
635 return r1.slerp( 2 * t * (1-t), r2 );
677 friend std::ostream& operator<<( std::ostream& lhs, const Vec3<T> rhs )
679 lhs <<
"[" << rhs.
x <<
"," << rhs.y <<
"," << rhs.z <<
"]";
701 :
x( 0 ),
y( 0 ),
z( 0 ),
w( 0 )
704 :
x( nx ),
y( ny ),
z( nz ),
w( nw )
707 :
x( src.
x ),
y( src.
y ),
z( src.
z ),
w( aW )
710 :
x( src.
x ),
y( src.
y ),
z( src.
z ),
w( src.
w )
712 template<
typename FromT>
714 :
x( static_cast<T>( src.
x ) ),
y( static_cast<T>( src.
y ) ),
z( static_cast<T>( src.
z ) ),
w( static_cast<T>( src.
w ) )
716 explicit Vec4(
const T *d ) :
x( d[0] ),
y( d[1] ),
z( d[2] ),
w( d[3] ) {}
718 void set( T ax, T ay, T az, T aw )
720 x = ax;
y = ay;
z = az;
w = aw;
725 x = rhs.
x;
y = rhs.
y;
z = rhs.
z;
w = rhs.
w;
730 x = rhs.
x;
y = rhs.
y;
z = rhs.
z;
w = rhs.
w;
734 template<
typename FromT>
737 x =
static_cast<T
>(rhs.
x);
y =
static_cast<T
>(rhs.
y);
z =
static_cast<T
>(rhs.
z);
w =
static_cast<T
>(rhs.
w);
743 assert( n >= 0 && n <= 3 );
749 assert( n >= 0 && n <= 3 );
753 T*
ptr()
const {
return &(
const_cast<Vec4*
>( this )->
x); }
773 return (
x == rhs.
x ) && (
y == rhs.
y ) && (
z == rhs.
z ) && (
w == rhs.
w );
778 return ! (*
this == rhs);
783 return x*rhs.
x +
y*rhs.
y +
z*rhs.
z;
793 return ( *
this - rhs ).length();
798 return ( *
this - rhs ).lengthSquared();
815 T invS = ((T)1) /
length();
824 T invS = ((T)1) /
length();
846 if( ( lenSq > maxLength * maxLength ) && ( lenSq > 0 ) ) {
872 if( ( lenSq > maxLength * maxLength ) && ( lenSq > 0 ) ) {
874 return Vec4<T>(
x * ratio,
y * ratio,
z * ratio,
w * ratio );
903 return (*
this) + ( r - (*this) ) * fact;
908 x =
x + ( rhs.
x -
x ) * fact;
y = y + ( rhs.
y -
y ) * fact;
z = z + ( rhs.
z -
z ) * fact;
w = w + ( rhs.
w -
w ) * fact;
918 return Vec4<T>(
static_cast<T
>( 0 ), static_cast<T>( 0 ),
static_cast<T
>( 0 ), static_cast<T>( 0 ) );
923 return Vec4<T>(
static_cast<T
>( 1 ), static_cast<T>( 1 ),
static_cast<T
>( 1 ), static_cast<T>( 1 ) );
928 T cosAlpha,
alpha, sinAlpha;
933 cosAlpha = this->
dot( r );
946 return *
this * t1 + r * t2;
954 return r1.
slerp( 2 * t * (1-t), r2 );
1253 friend std::ostream& operator<<( std::ostream& lhs, const Vec4<T>& rhs )
1255 lhs <<
"[" << rhs.
x <<
"," << rhs.y <<
"," << rhs.z <<
"," << rhs.w <<
"]";
1268 template<
typename T>
1271 const T epsilon = (T)0.0000001;
1275 else if( car.
y > 0 ) theta = (T)
M_PI / 2;
1276 else theta = ( (T)
M_PI * 3 ) / 2;
1278 else if ( car.
x > 0 ) {
1289 template<
typename T>
1309 template <
typename T>
bool isNaN(
const Vec2<T>&
a ) {
return std::isnan( a.
x ) || std::isnan( a.
y ); }
1310 template <
typename T>
bool isNaN(
const Vec3<T>&
a ) {
return std::isnan( a.x ) || std::isnan( a.y ) || std::isnan( a.z ); }
1311 template <
typename T>
bool isNaN(
const Vec4<T>&
a ) {
return std::isnan( a.
x ) || std::isnan( a.
y ) || std::isnan( a.
z ) || std::isnan( a.
w ); }
Vec4< T > zzzy() const
Definition: Vector.h:1165
Vec4< T > xzxw() const
Definition: Vector.h:1031
Vec4< T > yyyx() const
Definition: Vector.h:1080
Vec3< T > zxy() const
Definition: Vector.h:668
static T sqrt(T x)
Definition: CinderMath.h:63
static Vec4< T > one()
Definition: Vector.h:921
Vec4< T > zxzy() const
Definition: Vector.h:1133
GLdouble GLdouble GLdouble r
Definition: GLee.h:1474
Vec4< T > wzyx() const
Definition: Vector.h:1224
Vec4< T > xzxx() const
Definition: Vector.h:1028
bool operator!=(const Vec2< T > &rhs) const
Definition: Vector.h:149
const Vec3< T > operator/(const Vec3< T > &rhs) const
Definition: Vector.h:395
Vec4< T > zxzx() const
Definition: Vector.h:1132
Vec3< T > safeNormalized() const
Definition: Vector.h:510
Vec3< T > & operator=(const Vec3< FromT > &rhs)
Definition: Vector.h:370
T x
Definition: Vector.h:694
Vec4< T > yywx() const
Definition: Vector.h:1088
Vec4< T > normalized() const
Definition: Vector.h:822
Vec4< T > xzyz() const
Definition: Vector.h:1034
T * ptr() const
Definition: Vector.h:390
Vec4< T > wxyx() const
Definition: Vector.h:1192
Vec4< T > wwzw() const
Definition: Vector.h:1247
GLenum GLint GLint y
Definition: GLee.h:987
Vec2< T > xx() const
Definition: Vector.h:958
Vec4< T > zwxx() const
Definition: Vector.h:1172
Vec2< T > & operator=(const Vec2< T > &rhs)
Definition: Vector.h:107
T lengthSquared() const
Definition: Vector.h:443
void limit(DIST maxLength)
Limits the length of a Vec2 to maxLength, scaling it proportionally if necessary. ...
Definition: Vector.h:230
Definition: CinderMath.h:40
Vec2< T > xy() const
Definition: Vector.h:640
static T cos(T x)
Definition: CinderMath.h:46
void invert()
Definition: Vector.h:891
Vec3< T > xxz() const
Definition: Vector.h:651
Vec4< T > xyzw() const
Definition: Vector.h:1023
bool isNaN(const Vec2< T > &a)
Definition: Vector.h:1309
Vec4< T > zzwx() const
Definition: Vector.h:1168
Vec4< T > wwwy() const
Definition: Vector.h:1249
Vec4< T > xyyx() const
Definition: Vector.h:1016
Vec4< T > yzww() const
Definition: Vector.h:1107
Vec2< T > xx() const
Definition: Vector.h:276
Vec3< T > yzy() const
Definition: Vector.h:984
Vec4< T > yzwz() const
Definition: Vector.h:1106
Vec4< T > xyxw() const
Definition: Vector.h:1015
const Vec2< T > operator+(const Vec2< T > &rhs) const
Definition: Vector.h:128
Vec4< T > wzyz() const
Definition: Vector.h:1226
Vec4< T > wwyx() const
Definition: Vector.h:1240
void safeNormalize()
Definition: Vector.h:194
Vec4< T > xxyw() const
Definition: Vector.h:1003
Vec4< T > yzzx() const
Definition: Vector.h:1100
Vec4< T > yyzx() const
Definition: Vector.h:1084
Vec4< T > wzxy() const
Definition: Vector.h:1221
GLfloat GLfloat nz
Definition: GLee.h:8437
const Vec3< T > operator/(T rhs) const
Definition: Vector.h:400
Vec3< T > zzx() const
Definition: Vector.h:992
Vec3< T > zzx() const
Definition: Vector.h:673
Vec3< T > yzz() const
Definition: Vector.h:666
T dot(const Vec3< T > &rhs) const
Definition: Vector.h:418
Vec4< T > xxyx() const
Definition: Vector.h:1000
Vec3< T > operator-() const
Definition: Vector.h:406
int int * max
Definition: GLee.h:17208
Vec3(const Vec3< FromT > &src)
Definition: Vector.h:342
Vec3< T > yzy() const
Definition: Vector.h:665
Vec4< T > xzyw() const
Definition: Vector.h:1035
void normalize()
Definition: Vector.h:484
Vec2< float > Vec2f
Definition: Vector.h:1314
const Vec4< T > operator+(const Vec4< T > &rhs) const
Definition: Vector.h:755
Vec4< T > wxzw() const
Definition: Vector.h:1199
const Vec4< T > operator/(T rhs) const
Definition: Vector.h:763
T value_type
Definition: Vector.h:697
Vec4< T > yzyz() const
Definition: Vector.h:1098
void safeNormalize()
Definition: Vector.h:499
Vec4< T > yxxz() const
Definition: Vector.h:1062
Vec2< T > & operator/=(const Vec2< T > &rhs)
Definition: Vector.h:135
T dot(const Vec2< T > &a, const Vec2< T > &b)
Definition: Vector.h:1302
Vec4< T > yxwx() const
Definition: Vector.h:1072
Vec3< T > & operator+=(T rhs)
Definition: Vector.h:401
Vec4< T > xwyz() const
Definition: Vector.h:1050
Vec4(const Vec3< T > &src, T aW=0)
Definition: Vector.h:706
static Vec2< T > yAxis()
Definition: Vector.h:312
Vec4< T > zyxz() const
Definition: Vector.h:1142
static T sin(T x)
Definition: CinderMath.h:47
Vec4< T > zzwy() const
Definition: Vector.h:1169
Vec4< T > xxyy() const
Definition: Vector.h:1001
Vec4< T > zwzz() const
Definition: Vector.h:1182
T y
Definition: Vector.h:694
Vec4< T > xyzy() const
Definition: Vector.h:1021
Vec4< T > ywyw() const
Definition: Vector.h:1115
Vec4(const Vec4< T > &src)
Definition: Vector.h:709
Vec3< T > xzy() const
Definition: Vector.h:975
const T & operator[](int n) const
Definition: Vector.h:384
Vec4< T > zwyx() const
Definition: Vector.h:1176
Vec3< T > zxx() const
Definition: Vector.h:667
void invert()
Definition: Vector.h:474
Vec4< T > xyyy() const
Definition: Vector.h:1017
void set(T ax, T ay, T az)
Definition: Vector.h:351
Vec4< T > xyzz() const
Definition: Vector.h:1022
Vec4< T > wyzy() const
Definition: Vector.h:1213
T value_type
Definition: Vector.h:324
Vec3< T > lerp(T fact, const Vec3< T > &rhs) const
Definition: Vector.h:582
Vec3()
Definition: Vector.h:327
DIST distance(const Vec2< T > &rhs) const
Definition: Vector.h:165
Vec4< T > xzxz() const
Definition: Vector.h:1030
Vec4< T > wxww() const
Definition: Vector.h:1203
Vec4< T > xyzx() const
Definition: Vector.h:1020
Vec4< T > zyzx() const
Definition: Vector.h:1148
Vec4< T > yyxw() const
Definition: Vector.h:1079
T z
Definition: Vector.h:694
Vec4< T > ywzz() const
Definition: Vector.h:1118
Vec3< T > & operator/=(const Vec3< T > &rhs)
Definition: Vector.h:399
T & operator[](int n)
Definition: Vector.h:741
Vec4< T > wxxz() const
Definition: Vector.h:1190
void normalize()
Definition: Vector.h:180
void set(const Vec4< T > &rhs)
Definition: Vector.h:723
T z
Definition: Vector.h:321
Vec2< T > toPolar(Vec2< T > car)
Converts a coordinate from rectangular (Cartesian) coordinates to polar coordinates of the form (radi...
Definition: Vector.h:1269
T w
Definition: Vector.h:694
Vec4(const Vec4< FromT > &src)
Definition: Vector.h:713
Vec4< T > wxxx() const
Definition: Vector.h:1188
Vec4< float > Vec4f
Definition: Vector.h:1320
bool operator==(const Vec4< T > &rhs) const
Definition: Vector.h:771
Vec3< T > xzy() const
Definition: Vector.h:656
GLuint src
Definition: GLee.h:10873
Vec4< T > cross(const Vec4< T > &rhs) const
Definition: Vector.h:786
Vec3< T > xyx() const
Definition: Vector.h:283
Vec4< T > & operator*=(T rhs)
Definition: Vector.h:766
T x
Definition: Vector.h:321
Vec4< T > zzyz() const
Definition: Vector.h:1162
static Vec2< T > NaN()
Definition: Vector.h:314
Vec4< T > xwxw() const
Definition: Vector.h:1047
Vec3< T > zyx() const
Definition: Vector.h:670
static Vec2< T > zero()
Definition: Vector.h:295
Vec3< T > yxx() const
Definition: Vector.h:658
GLfloat ny
Definition: GLee.h:8437
Vec3< T > xyz() const
Definition: Vector.h:654
Vec4< T > ywxz() const
Definition: Vector.h:1110
Vec4< T > & operator+=(T rhs)
Definition: Vector.h:764
Vec4< T > yywy() const
Definition: Vector.h:1089
Vec3< T > yxy() const
Definition: Vector.h:978
Vec3< T > limited(T maxLength) const
Returns a copy of the Vec3 with its length limited to maxLength, scaling it proportionally if necessa...
Definition: Vector.h:462
Vec3< T > xzz() const
Definition: Vector.h:657
Vec4< T > & operator=(const Vec4< FromT > &rhs)
Definition: Vector.h:735
T x
Definition: Vector.h:71
GLfloat angle
Definition: GLee.h:13523
Vec2< T > zz() const
Definition: Vector.h:966
Vec4< T > xxzw() const
Definition: Vector.h:1007
void limit(T maxLength)
Limits the length of a Vec4 to maxLength, scaling it proportionally if necessary. ...
Definition: Vector.h:842
Vec2< T > normalized() const
Definition: Vector.h:187
Vec3(const Vec2< T > &v2, T aZ)
Definition: Vector.h:334
Vec4< T > zxzw() const
Definition: Vector.h:1135
Vec4< T > wywz() const
Definition: Vector.h:1218
Vec4< T > & operator=(const Vec4< T > &rhs)
Definition: Vector.h:728
Vec3< T > xxy() const
Definition: Vector.h:969
Vec4< T > xwxz() const
Definition: Vector.h:1046
T y
Definition: Vector.h:321
Vec4< T > zyzy() const
Definition: Vector.h:1149
Vec4< T > yyww() const
Definition: Vector.h:1091
void rotateX(T angle)
Definition: Vector.h:530
Vec2(const Vec2< T > &src)
Definition: Vector.h:80
Vec4< T > yzxx() const
Definition: Vector.h:1092
Vec3< T > yzx() const
Definition: Vector.h:983
Vec4< T > wxzy() const
Definition: Vector.h:1197
T dot(const Vec2< T > &rhs) const
Definition: Vector.h:154
Vec3< T > yyx() const
Definition: Vector.h:980
Vec4< T > xxyz() const
Definition: Vector.h:1002
Vec4< T > wyzw() const
Definition: Vector.h:1215
Vec4< T > zyxx() const
Definition: Vector.h:1140
static Vec3< T > zero()
Definition: Vector.h:597
const Vec4< T > operator/(const Vec4< T > &rhs) const
Definition: Vector.h:758
Vec4< T > xwyw() const
Definition: Vector.h:1051
Vec4< T > ywyz() const
Definition: Vector.h:1114
static Vec4< T > xAxis()
Definition: Vector.h:1259
Vec4< T > wzwy() const
Definition: Vector.h:1233
Vec4< T > yzyw() const
Definition: Vector.h:1099
void lerpEq(T fact, const Vec2< T > &rhs)
Definition: Vector.h:270
Vec4< T > wyzx() const
Definition: Vector.h:1212
Vec2< T > zy() const
Definition: Vector.h:965
void set(const Vec3< T > &rhs)
Definition: Vector.h:356
Vec4< T > yzyy() const
Definition: Vector.h:1097
Vec3< T > zzy() const
Definition: Vector.h:993
Vec4< int > Vec4i
Definition: Vector.h:1319
ColorT< T > operator*(Y s, const ColorT< T > &c)
Definition: Color.h:391
T distance(const Vec3< T > &rhs) const
Definition: Vector.h:428
Vec4< T > wzzz() const
Definition: Vector.h:1230
Vec4< T > wyxx() const
Definition: Vector.h:1204
Vec3< T > yyy() const
Definition: Vector.h:981
Vec4< T > yzxw() const
Definition: Vector.h:1095
Vec4< T > xwww() const
Definition: Vector.h:1059
Vec3< T > yyz() const
Definition: Vector.h:982
const Vec2< T > operator/(const Vec2< T > &rhs) const
Definition: Vector.h:131
Vec3< T > zzz() const
Definition: Vector.h:675
T cross(const Vec2< T > &rhs) const
Returns the z component of the cross if the two operands were Vec3's on the XY plane, the equivalent of Vec3(*this).cross( Vec3(rhs) ).z.
Definition: Vector.h:160
Vec4< T > zwxz() const
Definition: Vector.h:1174
Vec3< T > yyz() const
Definition: Vector.h:663
Vec4< T > xwxy() const
Definition: Vector.h:1045
Vec4< T > xyww() const
Definition: Vector.h:1027
T TYPE
Definition: Vector.h:73
Vec4< T > xwwy() const
Definition: Vector.h:1057
Vec4< T > yxyw() const
Definition: Vector.h:1067
Vec4< T > zwwy() const
Definition: Vector.h:1185
void normalize()
Definition: Vector.h:813
static Vec4< T > zAxis()
Definition: Vector.h:1261
Vec4()
Definition: Vector.h:700
Vec4< T > zwyy() const
Definition: Vector.h:1177
Vec4< T > wwwx() const
Definition: Vector.h:1248
Vec4< T > ywzy() const
Definition: Vector.h:1117
T & operator[](int n)
Definition: Vector.h:378
Vec4< T > wzwz() const
Definition: Vector.h:1234
Vec4< T > yywz() const
Definition: Vector.h:1090
T dot(const Vec4< T > &rhs) const
Definition: Vector.h:781
Vec4< T > xzzz() const
Definition: Vector.h:1038
Vec4< T > yyzz() const
Definition: Vector.h:1086
Vec4< T > & operator*=(const Vec4< T > &rhs)
Definition: Vector.h:761
const Vec2< T > operator-(const Vec2< T > &rhs) const
Definition: Vector.h:129
Vec4< T > xwzy() const
Definition: Vector.h:1053
const T & operator[](int n) const
Definition: Vector.h:120
const Vec4< T > operator*(const Vec4< T > &rhs) const
Definition: Vector.h:757
Vec3< T > xzz() const
Definition: Vector.h:976
Vec4< T > ywzx() const
Definition: Vector.h:1116
Vec4< T > & operator-=(T rhs)
Definition: Vector.h:765
Vec4< T > squad(T t, const Vec4< T > &tangentA, const Vec4< T > &tangentB, const Vec4< T > &end) const
Definition: Vector.h:950
Vec3< T > zyx() const
Definition: Vector.h:989
const T & operator[](int n) const
Definition: Vector.h:747
void rotate(Vec3< T > axis, T angle)
Definition: Vector.h:560
static const int DIM
Definition: Vector.h:325
Vec4< T > wxxw() const
Definition: Vector.h:1191
Vec3< float > Vec3f
Definition: Vector.h:1317
static Vec3< T > yAxis()
Definition: Vector.h:684
Vec4< T > zxxx() const
Definition: Vector.h:1124
Vec4< T > zyzz() const
Definition: Vector.h:1150
Vec4< T > zxyz() const
Definition: Vector.h:1130
Vec4< T > ywxw() const
Definition: Vector.h:1111
Vec2< T > xz() const
Definition: Vector.h:641
Vec4< T > ywzw() const
Definition: Vector.h:1119
Vec4< T > yxzy() const
Definition: Vector.h:1069
Vec3< T > yyx() const
Definition: Vector.h:287
T lengthSquared() const
Definition: Vector.h:807
Vec4< double > Vec4d
Definition: Vector.h:1321
Vec2< T > zx() const
Definition: Vector.h:964
void lerpEq(T fact, const Vec4< T > &rhs)
Definition: Vector.h:906
Vec4< T > yzwy() const
Definition: Vector.h:1105
Vec4< T > ywww() const
Definition: Vector.h:1123
const Vec3< T > operator-(const Vec3< T > &rhs) const
Definition: Vector.h:393
Vec4< T > wwxy() const
Definition: Vector.h:1237
Vec4< T > zzxx() const
Definition: Vector.h:1156
Vec2< T > & operator=(const Vec2< FromT > &rhs)
Definition: Vector.h:100
Vec4< T > xxzx() const
Definition: Vector.h:1004
Vec2< double > Vec2d
Definition: Vector.h:1315
Vec4< T > xwyy() const
Definition: Vector.h:1049
Vec4< T > wyxz() const
Definition: Vector.h:1206
static Vec2< T > xAxis()
Definition: Vector.h:311
Vec4< T > ywyy() const
Definition: Vector.h:1113
Vec3< T > & operator/=(T rhs)
Definition: Vector.h:404
Vec2< T > yz() const
Definition: Vector.h:644
Vec3< T > getOrthogonal() const
Returns a vector which is orthogonal to this.
Definition: Vector.h:522
Vec2()
Definition: Vector.h:78
Vec4< T > wwxw() const
Definition: Vector.h:1239
Vec4< T > xzwx() const
Definition: Vector.h:1040
Vec4< T > wwxz() const
Definition: Vector.h:1238
Vec4< T > xxwz() const
Definition: Vector.h:1010
Vec4< T > wyzz() const
Definition: Vector.h:1214
Vec4< T > wwyz() const
Definition: Vector.h:1242
Vec3< T > yzz() const
Definition: Vector.h:985
Vec2(const Vec2< FromT > &src)
Definition: Vector.h:84
Vec3< T > yzx() const
Definition: Vector.h:664
Vec4< T > xxxy() const
Definition: Vector.h:997
Vec4< T > zyxy() const
Definition: Vector.h:1141
Vec4< T > & operator/=(T rhs)
Definition: Vector.h:767
Vec4< T > zwzy() const
Definition: Vector.h:1181
Vec4< T > zzxw() const
Definition: Vector.h:1159
Vec3(const T *d)
Definition: Vector.h:340
Vec4< T > wxwy() const
Definition: Vector.h:1201
Vec4< T > wxxy() const
Definition: Vector.h:1189
GLclampf GLclampf GLclampf alpha
Definition: GLee.h:951
Vec2< T > xx() const
Definition: Vector.h:639
Vec4< T > ywwz() const
Definition: Vector.h:1122
Vec2< T > safeNormalized() const
Definition: Vector.h:204
Vec3< T > cross(const Vec3< T > &a, const Vec3< T > &b)
Definition: Vector.h:1306
Vec4< T > wywx() const
Definition: Vector.h:1216
static T acos(T x)
Definition: CinderMath.h:42
T TYPE
Definition: Vector.h:323
void rotate(DIST radians)
Definition: Vector.h:215
static Vec4< T > NaN()
Definition: Vector.h:1264
bool operator==(const Vec3< T > &rhs) const
Definition: Vector.h:408
Vec4< T > xywx() const
Definition: Vector.h:1024
Vec4(const T *d)
Definition: Vector.h:716
Vec4< T > xyyw() const
Definition: Vector.h:1019
Vec3(const Vec2< T > &v2)
Definition: Vector.h:337
Vec3< T > xzx() const
Definition: Vector.h:655
Vec4< T > xyxz() const
Definition: Vector.h:1014
Vec4< T > zzzw() const
Definition: Vector.h:1167
Vec3< T > slerp(T fact, const Vec3< T > &r) const
Definition: Vector.h:607
Vec4< T > wxzz() const
Definition: Vector.h:1198
Vec3< T > yyy() const
Definition: Vector.h:288
Vec3< T > yyy() const
Definition: Vector.h:662
Vec4< T > wyyw() const
Definition: Vector.h:1211
Vec3< T > xxy() const
Definition: Vector.h:650
Vec4< T > xywz() const
Definition: Vector.h:1026
Vec4< T > wyxw() const
Definition: Vector.h:1207
Vec4< T > xxwx() const
Definition: Vector.h:1008
Vec4< T > yzwx() const
Definition: Vector.h:1104
Vec4< T > wyww() const
Definition: Vector.h:1219
Vec4< T > ywwx() const
Definition: Vector.h:1120
Vec4< T > wzzx() const
Definition: Vector.h:1228
Vec4< T > limited(T maxLength) const
Returns a copy of the Vec4 with its length limited to maxLength, scaling it proportionally if necessa...
Definition: Vector.h:868
GLfloat GLfloat GLfloat v2
Definition: GLee.h:2451
bool operator!=(const Vec3< T > &rhs) const
Definition: Vector.h:413
Vec3< T > xzx() const
Definition: Vector.h:974
Vec4< T > xwzz() const
Definition: Vector.h:1054
Vec4< T > zywy() const
Definition: Vector.h:1153
GLenum GLint x
Definition: GLee.h:987
Vec4< T > wwzz() const
Definition: Vector.h:1246
Vec4< T > wzzw() const
Definition: Vector.h:1231
Vec3< T > zyy() const
Definition: Vector.h:671
Vec4< T > xwwz() const
Definition: Vector.h:1058
Vec4< T > wzyw() const
Definition: Vector.h:1227
static Vec4< T > wAxis()
Definition: Vector.h:1262
Vec3< T > xyy() const
Definition: Vector.h:972
Vec3< T > yxy() const
Definition: Vector.h:659
Vec4< T > xwwx() const
Definition: Vector.h:1056
GLenum GLsizei n
Definition: GLee.h:5780
Vec4< T > zyyx() const
Definition: Vector.h:1144
Vec4< T > xwxx() const
Definition: Vector.h:1044
Vec4< T > wzxx() const
Definition: Vector.h:1220
void lerpEq(T fact, const Vec3< T > &rhs)
Definition: Vector.h:587
Vec4< T > ywyx() const
Definition: Vector.h:1112
Vec2< T > & operator+=(T rhs)
Definition: Vector.h:137
Vec3< T > zzz() const
Definition: Vector.h:994
Vec4< T > xzzw() const
Definition: Vector.h:1039
Vec4< T > zxwy() const
Definition: Vector.h:1137
void safeNormalize()
Definition: Vector.h:829
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:8449
Vec4< T > xzwz() const
Definition: Vector.h:1042
Vec3< T > xxx() const
Definition: Vector.h:968
Vec4< T > ywwy() const
Definition: Vector.h:1121
Vec4< T > zxzz() const
Definition: Vector.h:1134
Vec4< T > xxxz() const
Definition: Vector.h:998
Vec4< T > wzwx() const
Definition: Vector.h:1232
VECTRAIT< T >::DIST DIST
Definition: Vector.h:75
Vec4< T > xyyz() const
Definition: Vector.h:1018
Vec3< T > xyz() const
Definition: Vector.h:973
Vec4< T > xxwy() const
Definition: Vector.h:1009
Vec4< T > xxxx() const
Definition: Vector.h:996
Vec2< T > & operator/=(T rhs)
Definition: Vector.h:140
Vec4< T > xzzx() const
Definition: Vector.h:1036
Vec2< T > inverse() const
Definition: Vector.h:260
Vec2< T > xy() const
Definition: Vector.h:959
const GLdouble * v
Definition: GLee.h:1384
Vec2< T > & operator-=(const Vec2< T > &rhs)
Definition: Vector.h:133
Vec4< T > wxyw() const
Definition: Vector.h:1195
Vec4< T > ywxy() const
Definition: Vector.h:1109
Vec4< T > yxww() const
Definition: Vector.h:1075
Vec2< T > & operator+=(const Vec2< T > &rhs)
Definition: Vector.h:132
T distanceSquared(const Vec4< T > &rhs) const
Definition: Vector.h:796
GLdouble GLdouble z
Definition: GLee.h:1911
GLboolean GLboolean GLboolean b
Definition: GLee.h:2964
Vec4< T > xyxx() const
Definition: Vector.h:1012
Vec4< T > zzww() const
Definition: Vector.h:1171
Vec2< T > yy() const
Definition: Vector.h:643
Vec3< T > zyz() const
Definition: Vector.h:672
T distanceSquared(const Vec3< T > &rhs) const
Definition: Vector.h:433
Vec3< T > xyx() const
Definition: Vector.h:652
Vec4< T > wxyy() const
Definition: Vector.h:1193
DIST length() const
Definition: Vector.h:175
Vec4< T > wxwx() const
Definition: Vector.h:1200
Vec4< T > xzww() const
Definition: Vector.h:1043
Vec4< T > ywxx() const
Definition: Vector.h:1108
const Vec3< T > operator*(const Vec3< T > &rhs) const
Definition: Vector.h:394
T lengthSquared() const
Definition: Vector.h:224
Vec2< T > xz() const
Definition: Vector.h:960
Vec4< T > xyxy() const
Definition: Vector.h:1013
T y
Definition: Vector.h:71
Vec4< T > yyyy() const
Definition: Vector.h:1081
Vec4< T > zzzx() const
Definition: Vector.h:1164
Vec4< T > wwwz() const
Definition: Vector.h:1250
Vec4< T > zwyz() const
Definition: Vector.h:1178
Vec2(T nx, T ny)
Definition: Vector.h:79
Vec3< T > xxx() const
Definition: Vector.h:281
const Vec2< T > operator*(const Vec2< T > &rhs) const
Definition: Vector.h:130
Vec4< T > zwxw() const
Definition: Vector.h:1175
Vec3< T > yxz() const
Definition: Vector.h:660
GLuint GLuint end
Definition: GLee.h:963
Vec4< T > yxyz() const
Definition: Vector.h:1066
Vec3< T > yxy() const
Definition: Vector.h:286
Vec4< T > zxyy() const
Definition: Vector.h:1129
T & operator[](int n)
Definition: Vector.h:114
Vec4< T > zxwz() const
Definition: Vector.h:1138
Vec4< T > wwzy() const
Definition: Vector.h:1245
Vec4< T > wyyx() const
Definition: Vector.h:1208
Vec3< T > zxz() const
Definition: Vector.h:669
Vec3< T > xxz() const
Definition: Vector.h:970
Vec2< T > yy() const
Definition: Vector.h:962
Vec2< T > & operator*=(const Vec2< T > &rhs)
Definition: Vector.h:134
Vec3< double > Vec3d
Definition: Vector.h:1318
bool operator==(const Vec2< T > &rhs) const
Definition: Vector.h:144
const Vec3< T > operator+(const Vec3< T > &rhs) const
Definition: Vector.h:392
Vec3< T > zxy() const
Definition: Vector.h:987
T value_type
Definition: Vector.h:74
#define M_PI
Definition: CinderMath.h:121
Vec4< T > wywy() const
Definition: Vector.h:1217
Vec3< T > zxz() const
Definition: Vector.h:988
Vec4< T > yxxw() const
Definition: Vector.h:1063
Vec4< T > wwxx() const
Definition: Vector.h:1236
Vec4< T > zxww() const
Definition: Vector.h:1139
Vec4< T > wxzx() const
Definition: Vector.h:1196
Vec3< T > xyx() const
Definition: Vector.h:971
Vec4< T > zzwz() const
Definition: Vector.h:1170
Vec4< T > yyzw() const
Definition: Vector.h:1087
Vec4(T nx, T ny, T nz, T nw=0)
Definition: Vector.h:703
Vec4< T > yzzw() const
Definition: Vector.h:1103
Vec4< T > yyyz() const
Definition: Vector.h:1082
Vec3< T > cross(const Vec3< T > &rhs) const
Definition: Vector.h:423
Vec4< T > yxzz() const
Definition: Vector.h:1070
Vec4< T > xzwy() const
Definition: Vector.h:1041
static Vec3< T > xAxis()
Definition: Vector.h:683
Vec4< T > wzyy() const
Definition: Vector.h:1225
GLboolean GLboolean GLboolean GLboolean a
Definition: GLee.h:2964
static T atan(T x)
Definition: CinderMath.h:44
Vec4< T > & operator-=(const Vec4< T > &rhs)
Definition: Vector.h:760
Vec4< T > yxzx() const
Definition: Vector.h:1068
Vec4< T > xwzx() const
Definition: Vector.h:1052
Vec4< T > zzyx() const
Definition: Vector.h:1160
Vec4< T > zzxy() const
Definition: Vector.h:1157
Vec4< T > wwyw() const
Definition: Vector.h:1243
Vec4< T > xxww() const
Definition: Vector.h:1011
Vec4< T > wyyz() const
Definition: Vector.h:1210
Vec4< T > zxxw() const
Definition: Vector.h:1127
Vec4< T > zzyy() const
Definition: Vector.h:1161
void set(T ax, T ay, T az, T aw)
Definition: Vector.h:718
Vec3< T > xxy() const
Definition: Vector.h:282
Vec4< T > & operator/=(const Vec4< T > &rhs)
Definition: Vector.h:762
Vec4< T > xzyy() const
Definition: Vector.h:1033
Vec2< T > yx() const
Definition: Vector.h:961
Vec4< T > zxxy() const
Definition: Vector.h:1125
static Vec4< T > yAxis()
Definition: Vector.h:1260
Vec4< T > yyxy() const
Definition: Vector.h:1077
Vec2< T > zy() const
Definition: Vector.h:646
Vec3< T > zxx() const
Definition: Vector.h:986
Vec4< T > zyyw() const
Definition: Vector.h:1147
Vec4< T > xxzy() const
Definition: Vector.h:1005
Vec4< T > yxyy() const
Definition: Vector.h:1065
Vec4< T > zyxw() const
Definition: Vector.h:1143
Vec4< T > wyxy() const
Definition: Vector.h:1205
Vec3< T > yyx() const
Definition: Vector.h:661
void invert()
Definition: Vector.h:254
Vec4< T > yyxx() const
Definition: Vector.h:1076
static Vec4< T > max()
Definition: Vector.h:911
Vec4< T > & operator+=(const Vec4< T > &rhs)
Definition: Vector.h:759
Vec2< T > yy() const
Definition: Vector.h:279
Vec4< T > zxxz() const
Definition: Vector.h:1126
void set(const Vec2< T > &rhs)
Definition: Vector.h:93
Vec3(const Vec3< T > &src)
Definition: Vector.h:331
Vec2< T > yx() const
Definition: Vector.h:278
Vec4< T > wzxw() const
Definition: Vector.h:1223
Vec2(const T *d)
Definition: Vector.h:81
Vec4< T > wxyz() const
Definition: Vector.h:1194
Vec4< T > xzxy() const
Definition: Vector.h:1029
bool operator!=(const Vec4< T > &rhs) const
Definition: Vector.h:776
Vec4< T > zyyz() const
Definition: Vector.h:1146
void rotateY(T angle)
Definition: Vector.h:540
Vec4< T > xxzz() const
Definition: Vector.h:1006
Vec4< T > zywx() const
Definition: Vector.h:1152
Vec4< T > yzxz() const
Definition: Vector.h:1094
Vec4< T > yyxz() const
Definition: Vector.h:1078
Vec4< T > yzzy() const
Definition: Vector.h:1101
Vec3< T > xxx() const
Definition: Vector.h:649
Vec4< T > xywy() const
Definition: Vector.h:1025
static Vec3< T > NaN()
Definition: Vector.h:687
Vec4< T > zywz() const
Definition: Vector.h:1154
Vec4< T > zzzz() const
Definition: Vector.h:1166
Vec2< T > lerp(T fact, const Vec2< T > &r) const
Definition: Vector.h:265
static Vec3< T > one()
Definition: Vector.h:602
GLubyte GLubyte GLubyte GLubyte w
Definition: GLee.h:2685
static const int DIM
Definition: Vector.h:76
Vec4< T > yxyx() const
Definition: Vector.h:1064
void rotateZ(T angle)
Definition: Vector.h:550
T length() const
Definition: Vector.h:438
Vec4< T > wzww() const
Definition: Vector.h:1235
Vec4< T > zxyx() const
Definition: Vector.h:1128
T * ptr() const
Definition: Vector.h:753
Vec4< T > wwzx() const
Definition: Vector.h:1244
static Vec2< T > max()
Definition: Vector.h:290
Vec4< T > zwwz() const
Definition: Vector.h:1186
Vec3< T > & operator+=(const Vec3< T > &rhs)
Definition: Vector.h:396
Vec4< T > yxxx() const
Definition: Vector.h:1060
Vec2< T > & operator-=(T rhs)
Definition: Vector.h:138
void set(T ax, T ay)
Definition: Vector.h:88
Vec4< T > yzxy() const
Definition: Vector.h:1093
static Vec4< T > zero()
Definition: Vector.h:916
Vec3< T > xyy() const
Definition: Vector.h:653
Vec2< T > zz() const
Definition: Vector.h:647
Vec3(const Y &v)
Definition: Vector.h:346
const Vec2< T > operator/(T rhs) const
Definition: Vector.h:136
Vec2< T > limited(T maxLength) const
Returns a copy of the Vec2 with its length limited to maxLength, scaling it proportionally if necessa...
Definition: Vector.h:242
T TYPE
Definition: Vector.h:696
Vec4< T > yyyw() const
Definition: Vector.h:1083
Vec4< T > slerp(T fact, const Vec3< T > &r) const
Definition: Vector.h:926
Vec4< T > yzzz() const
Definition: Vector.h:1102
Vec2< T > xy() const
Definition: Vector.h:277
Vec2< T > yx() const
Definition: Vector.h:642
Vec4< T > zxyw() const
Definition: Vector.h:1131
Vec4< T > wzzy() const
Definition: Vector.h:1229
Vec4< T > zwwx() const
Definition: Vector.h:1184
void limit(T maxLength)
Limits the length of a Vec3 to maxLength, scaling it proportionally if necessary. ...
Definition: Vector.h:449
Vec4< T > zyzw() const
Definition: Vector.h:1151
GLdouble GLdouble t
Definition: GLee.h:1426
Vec2< T > operator-() const
Definition: Vector.h:142
Vec4< T > xxxw() const
Definition: Vector.h:999
GLdouble s
Definition: GLee.h:1378
Vec3< T > & operator*=(const Vec3< T > &rhs)
Definition: Vector.h:398
Vec4< T > yxwz() const
Definition: Vector.h:1074
Vec4< T > wwww() const
Definition: Vector.h:1251
Vec4< T > inverse() const
Definition: Vector.h:896
Vec3< T > zzy() const
Definition: Vector.h:674
Vec2< T > zx() const
Definition: Vector.h:645
Vec4< T > xzyx() const
Definition: Vector.h:1032
Vec3< T > xyy() const
Definition: Vector.h:284
Vec4< T > zwxy() const
Definition: Vector.h:1173
Vec3< T > & operator=(const Vec3< T > &rhs)
Definition: Vector.h:361
Vec4< T > zwzx() const
Definition: Vector.h:1180
Vec4< T > yxzw() const
Definition: Vector.h:1071
Vec4< T > zyyy() const
Definition: Vector.h:1145
Vec4< T > zwzw() const
Definition: Vector.h:1183
Vec3< T > squad(T t, const Vec3< T > &tangentA, const Vec3< T > &tangentB, const Vec3< T > &end) const
Definition: Vector.h:631
Vec3< T > yxz() const
Definition: Vector.h:979
Vec2< T > yz() const
Definition: Vector.h:963
Vec4< T > wyyy() const
Definition: Vector.h:1209
Vec3< T > yxx() const
Definition: Vector.h:285
Vec4< T > wxwz() const
Definition: Vector.h:1202
Vec4< T > xwzw() const
Definition: Vector.h:1055
Vec3< T > inverse() const
Definition: Vector.h:479
Vec3< T > & operator*=(T rhs)
Definition: Vector.h:403
Vec4< T > xzzy() const
Definition: Vector.h:1037
Vec3< T > yxx() const
Definition: Vector.h:977
Vec4< T > zyww() const
Definition: Vector.h:1155
T distance(const Vec4< T > &rhs) const
Definition: Vector.h:791
Vec4< T > wzxz() const
Definition: Vector.h:1222
Vec3< T > & operator-=(const Vec3< T > &rhs)
Definition: Vector.h:397
static Vec3< T > max()
Definition: Vector.h:592
Vec4< T > xwyx() const
Definition: Vector.h:1048
Vec3< T > zyy() const
Definition: Vector.h:990
Vec2< T > fromPolar(Vec2< T > pol)
Converts a coordinate from polar coordinates of the form (radius, theta) to rectangular coordinates...
Definition: Vector.h:1290
Vec3(T nx, T ny, T nz)
Definition: Vector.h:328
Vec2< T > & operator*=(T rhs)
Definition: Vector.h:139
T length() const
Definition: Vector.h:801
Vec4< T > yzyx() const
Definition: Vector.h:1096
static const int DIM
Definition: Vector.h:698
T distanceSquared(const Vec2< T > &rhs) const
Definition: Vector.h:170
Vec4< T > zzxz() const
Definition: Vector.h:1158
static Vec2< T > one()
Definition: Vector.h:300
Vec3< int > Vec3i
Definition: Vector.h:1316
Vec4< T > zwww() const
Definition: Vector.h:1187
Vec4< T > wwyy() const
Definition: Vector.h:1241
Vec4< T > lerp(T fact, const Vec4< T > &r) const
Definition: Vector.h:901
GLsizei maxLength
Definition: GLee.h:4974
Vec4< T > yxwy() const
Definition: Vector.h:1073
Vec4< T > zzyw() const
Definition: Vector.h:1163
Vec3< T > & operator-=(T rhs)
Definition: Vector.h:402
Vec4< T > operator-() const
Definition: Vector.h:769
Vec4< T > yxxy() const
Definition: Vector.h:1061
T * ptr() const
Definition: Vector.h:126
Vec4< T > zwyw() const
Definition: Vector.h:1179
Vec2< int > Vec2i
Definition: Vector.h:1313
Vec3< T > normalized() const
Definition: Vector.h:492
const Vec4< T > operator-(const Vec4< T > &rhs) const
Definition: Vector.h:756
Vec3< T > zyz() const
Definition: Vector.h:991
Vec4< T > zxwx() const
Definition: Vector.h:1136
Vec4< T > yyzy() const
Definition: Vector.h:1085
static Vec3< T > zAxis()
Definition: Vector.h:685