tf2
master
tf2 maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time.
|
Go to the documentation of this file.
28 #define Vector3Data Vector3DoubleData
29 #define Vector3DataName "Vector3DoubleData"
42 #if defined (__SPU__) && defined (__CELLOS_LV2__)
47 return *((
const vec_float4*)&m_floats[0]);
50 #else //__CELLOS_LV2__ __SPU__
51 #ifdef TF2_USE_SSE // _WIN32
67 #endif //__CELLOS_LV2__ __SPU__
94 m_floats[0] += v.m_floats[0]; m_floats[1] += v.m_floats[1];m_floats[2] += v.m_floats[2];
103 m_floats[0] -= v.m_floats[0]; m_floats[1] -= v.m_floats[1];m_floats[2] -= v.m_floats[2];
110 m_floats[0] *= s; m_floats[1] *= s;m_floats[2] *= s;
126 return m_floats[0] * v.m_floats[0] + m_floats[1] * v.m_floats[1] +m_floats[2] * v.m_floats[2];
185 m_floats[1] * v.m_floats[2] -m_floats[2] * v.m_floats[1],
186 m_floats[2] * v.m_floats[0] - m_floats[0] * v.m_floats[2],
187 m_floats[0] * v.m_floats[1] - m_floats[1] * v.m_floats[0]);
192 return m_floats[0] * (v1.m_floats[1] * v2.m_floats[2] - v1.m_floats[2] * v2.m_floats[1]) +
193 m_floats[1] * (v1.m_floats[2] * v2.m_floats[0] - v1.m_floats[0] * v2.m_floats[2]) +
194 m_floats[2] * (v1.m_floats[0] * v2.m_floats[1] - v1.m_floats[1] * v2.m_floats[0]);
201 return m_floats[0] < m_floats[1] ? (m_floats[0] <m_floats[2] ? 0 : 2) : (m_floats[1] <m_floats[2] ? 1 : 2);
208 return m_floats[0] < m_floats[1] ? (m_floats[1] <m_floats[2] ? 2 : 1) : (m_floats[0] <m_floats[2] ? 2 : 0);
213 return absolute().minAxis();
218 return absolute().maxAxis();
224 m_floats[0] = s * v0.m_floats[0] + rt * v1.m_floats[0];
225 m_floats[1] = s * v0.m_floats[1] + rt * v1.m_floats[1];
226 m_floats[2] = s * v0.m_floats[2] + rt * v1.m_floats[2];
236 return Vector3(m_floats[0] + (v.m_floats[0] - m_floats[0]) * t,
237 m_floats[1] + (v.m_floats[1] - m_floats[1]) * t,
238 m_floats[2] + (v.m_floats[2] -m_floats[2]) * t);
245 m_floats[0] *= v.m_floats[0]; m_floats[1] *= v.m_floats[1];m_floats[2] *= v.m_floats[2];
280 return ((m_floats[3]==other.m_floats[3]) && (m_floats[2]==other.m_floats[2]) && (m_floats[1]==other.m_floats[1]) && (m_floats[0]==other.m_floats[0]));
285 return !(*
this == other);
293 tf2SetMax(m_floats[0], other.m_floats[0]);
294 tf2SetMax(m_floats[1], other.m_floats[1]);
295 tf2SetMax(m_floats[2], other.m_floats[2]);
303 tf2SetMin(m_floats[0], other.m_floats[0]);
304 tf2SetMin(m_floats[1], other.m_floats[1]);
305 tf2SetMin(m_floats[2], other.m_floats[2]);
318 void getSkewSymmetricMatrix(Vector3* v0,Vector3* v1,Vector3* v2)
const
320 v0->setValue(0. ,-z() ,y());
321 v1->setValue(z() ,0. ,-x());
322 v2->setValue(-y() ,x() ,0.);
359 return Vector3(v1.m_floats[0] + v2.m_floats[0], v1.m_floats[1] + v2.m_floats[1], v1.m_floats[2] + v2.m_floats[2]);
366 return Vector3(v1.m_floats[0] * v2.m_floats[0], v1.m_floats[1] * v2.m_floats[1], v1.m_floats[2] * v2.m_floats[2]);
373 return Vector3(v1.m_floats[0] - v2.m_floats[0], v1.m_floats[1] - v2.m_floats[1], v1.m_floats[2] - v2.m_floats[2]);
379 return Vector3(-v.m_floats[0], -v.m_floats[1], -v.m_floats[2]);
386 return Vector3(v.m_floats[0] * s, v.m_floats[1] * s, v.m_floats[2] * s);
408 return Vector3(v1.m_floats[0] / v2.m_floats[0],v1.m_floats[1] / v2.m_floats[1],v1.m_floats[2] / v2.m_floats[2]);
413 tf2Dot(
const Vector3& v1,
const Vector3& v2)
423 return v1.distance2(v2);
431 return v1.distance(v2);
449 tf2Triple(
const Vector3& v1,
const Vector3& v2,
const Vector3& v3)
451 return v1.triple(v2, v3);
461 return v1.lerp(v2, t);
468 return (v - *
this).length2();
473 return (v - *
this).length();
485 Vector3 o = wAxis * wAxis.dot( *
this );
486 Vector3 x = *
this - o;
489 y = wAxis.cross( *
this );
527 if (m_floats[0] > maxVal)
530 maxVal = m_floats[0];
532 if (m_floats[1] > maxVal)
535 maxVal = m_floats[1];
537 if (m_floats[2] > maxVal)
542 if (m_floats[3] > maxVal)
559 if (m_floats[0] < minVal)
562 minVal = m_floats[0];
564 if (m_floats[1] < minVal)
567 minVal = m_floats[1];
569 if (m_floats[2] < minVal)
574 if (m_floats[3] < minVal)
627 unsigned char* dest = (
unsigned char*) &destVal;
628 const unsigned char* src =
reinterpret_cast<const unsigned char*
>(&sourceVal);
641 for (
int i=0;i<4;i++)
653 for (
int i=0;i<4;i++)
666 p.setValue(0,-n[2]*k,n[1]*k);
668 q.setValue(a*k,-n[0]*p[2],n[0]*p[1]);
674 p.setValue(-n.y()*k,n.x()*k,0);
676 q.setValue(-n.z()*p.y(),n.z()*p.x(),a*k);
695 for (
int i=0;i<4;i++)
696 dataOut.
m_floats[i] =
float(m_floats[i]);
701 for (
int i=0;i<4;i++)
702 m_floats[i] =
tf2Scalar(dataIn.m_floats[i]);
709 for (
int i=0;i<4;i++)
710 dataOut.m_floats[i] =
double(m_floats[i]);
715 for (
int i=0;i<4;i++)
716 m_floats[i] =
tf2Scalar(dataIn.m_floats[i]);
723 for (
int i=0;i<4;i++)
724 dataOut.m_floats[i] = m_floats[i];
729 for (
int i=0;i<4;i++)
730 m_floats[i] = dataIn.m_floats[i];
735 #endif //TF2_VECTOR3_H
TF2SIMD_FORCE_INLINE void tf2SwapScalarEndian(const tf2Scalar &sourceVal, tf2Scalar &destVal)
tf2SwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization
Definition: Vector3.h:625
TF2SIMD_FORCE_INLINE tf2Vector4(const tf2Scalar &x, const tf2Scalar &y, const tf2Scalar &z, const tf2Scalar &w)
Definition: Vector3.h:501
TF2SIMD_FORCE_INLINE tf2Scalar dot(const Quaternion &q1, const Quaternion &q2)
Calculate the dot product between two quaternions.
Definition: Quaternion.h:395
float m_floats[4]
Definition: Vector3.h:683
TF2SIMD_FORCE_INLINE int closestAxis4() const
Definition: Vector3.h:584
TF2SIMD_FORCE_INLINE Vector3 operator/(const Vector3 &v, const tf2Scalar &s)
Return the vector inversely scaled by s.
Definition: Vector3.h:398
TF2SIMD_FORCE_INLINE void tf2UnSwapVector3Endian(Vector3 &vector)
tf2UnSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization
Definition: Vector3.h:649
#define TF2SIMD_EPSILON
Definition: Scalar.h:202
TF2SIMD_FORCE_INLINE int maxAxis4() const
Definition: Vector3.h:523
TF2SIMD_FORCE_INLINE tf2Scalar tf2Sin(tf2Scalar x)
Definition: Scalar.h:180
TF2SIMD_FORCE_INLINE tf2Scalar tf2Dot(const Vector3 &v1, const Vector3 &v2)
Return the dot product between two vectors.
Definition: Vector3.h:413
TF2SIMD_FORCE_INLINE int minAxis4() const
Definition: Vector3.h:555
TF2SIMD_FORCE_INLINE Vector3 lerp(const Vector3 &v1, const Vector3 &v2, const tf2Scalar &t)
Return the linear interpolation between two vectors.
Definition: Vector3.h:459
Definition: Vector3.h:686
TF2SIMD_FORCE_INLINE void setValue(const tf2Scalar &x, const tf2Scalar &y, const tf2Scalar &z, const tf2Scalar &w)
Set x,y,z and zero w.
Definition: Vector3.h:612
TF2SIMD_FORCE_INLINE tf2Vector4()
Definition: Vector3.h:498
TF2SIMD_FORCE_INLINE tf2Scalar tf2Sqrt(tf2Scalar x)
Definition: Scalar.h:177
Definition: Vector3.h:681
ATTRIBUTE_ALIGNED16(class) QuadWord
The QuadWord class is base class for Vector3 and Quaternion. Some issues under PS3 Linux with IBM 2....
Definition: QuadWord.h:34
#define tf2FullAssert(x)
Definition: Scalar.h:148
TF2SIMD_FORCE_INLINE tf2Scalar tf2Distance2(const Vector3 &v1, const Vector3 &v2)
Return the distance squared between two vectors.
Definition: Vector3.h:421
#define TF2_LARGE_FLOAT
Definition: Scalar.h:161
TF2SIMD_FORCE_INLINE tf2Scalar tf2Angle(const Vector3 &v1, const Vector3 &v2)
Return the angle between two vectors.
Definition: Vector3.h:436
tf2Scalar getW() const
Definition: Vector3.h:520
TF2SIMD_FORCE_INLINE tf2Scalar tf2Acos(tf2Scalar x)
Definition: Scalar.h:182
TF2SIMD_FORCE_INLINE Vector3 tf2Cross(const Vector3 &v1, const Vector3 &v2)
Return the cross product of two vectors.
Definition: Vector3.h:443
TF2SIMD_FORCE_INLINE bool operator==(const Matrix3x3 &m1, const Matrix3x3 &m2)
Equality operator between two matrices It will test all elements are equal.
Definition: Matrix3x3.h:649
TF2SIMD_FORCE_INLINE Vector3 operator*(const Matrix3x3 &m, const Vector3 &v)
Definition: Matrix3x3.h:611
TF2SIMD_FORCE_INLINE void tf2SwapVector3Endian(const Vector3 &sourceVec, Vector3 &destVec)
tf2SwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization
Definition: Vector3.h:639
#define tf2RecipSqrt(x)
Definition: Scalar.h:199
#define TF2SIMD_FORCE_INLINE
Definition: Scalar.h:129
TF2SIMD_FORCE_INLINE void tf2PlaneSpace1(const Vector3 &n, Vector3 &p, Vector3 &q)
Definition: Vector3.h:660
TF2SIMD_FORCE_INLINE void tf2SetMin(T &a, const T &b)
Definition: MinMax.h:39
#define Vector3Data
Definition: Vector3.h:28
TF2SIMD_FORCE_INLINE tf2Scalar tf2Cos(tf2Scalar x)
Definition: Scalar.h:179
TF2SIMD_FORCE_INLINE tf2Scalar tf2Triple(const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
Definition: Vector3.h:449
Definition: buffer_core.h:53
TF2SIMD_FORCE_INLINE tf2Scalar tf2Fabs(tf2Scalar x)
Definition: Scalar.h:178
#define TF2_PUBLIC
Definition: visibility_control.h:57
TF2SIMD_FORCE_INLINE tf2Scalar angle(const Quaternion &q1, const Quaternion &q2)
Return the half angle between two quaternions.
Definition: Quaternion.h:410
TF2SIMD_FORCE_INLINE Vector3 operator+(const Vector3 &v1, const Vector3 &v2)
Return the sum of two vectors (Point symantics)
Definition: Vector3.h:357
Definition: Vector3.h:494
TF2SIMD_FORCE_INLINE tf2Scalar length(const Quaternion &q)
Return the length of a quaternion.
Definition: Quaternion.h:403
double tf2Scalar
The tf2Scalar type abstracts floating point numbers, to easily switch between double and single float...
Definition: Scalar.h:159
TF2SIMD_FORCE_INLINE tf2Scalar tf2Distance(const Vector3 &v1, const Vector3 &v2)
Return the distance between two vectors.
Definition: Vector3.h:429
TF2SIMD_FORCE_INLINE Quaternion operator-(const Quaternion &q)
Return the negative of a quaternion.
Definition: Quaternion.h:359
#define TF2SIMDSQRT12
Definition: Scalar.h:197
TF2SIMD_FORCE_INLINE void tf2SetMax(T &a, const T &b)
Definition: MinMax.h:48
TF2SIMD_FORCE_INLINE tf2Vector4 absolute4() const
Definition: Vector3.h:508
double m_floats[4]
Definition: Vector3.h:688