27 #define Vector3Data Vector3DoubleData
28 #define Vector3DataName "Vector3DoubleData"
41 #if defined (__SPU__) && defined (__CELLOS_LV2__)
46 return *((
const vec_float4*)&m_floats[0]);
49 #else //__CELLOS_LV2__ __SPU__
50 #ifdef TF2_USE_SSE // _WIN32
66 #endif //__CELLOS_LV2__ __SPU__
93 m_floats[0] += v.m_floats[0]; m_floats[1] += v.m_floats[1];m_floats[2] += v.m_floats[2];
102 m_floats[0] -= v.m_floats[0]; m_floats[1] -= v.m_floats[1];m_floats[2] -= v.m_floats[2];
109 m_floats[0] *= s; m_floats[1] *= s;m_floats[2] *= s;
125 return m_floats[0] * v.m_floats[0] + m_floats[1] * v.m_floats[1] +m_floats[2] * v.m_floats[2];
184 m_floats[1] * v.m_floats[2] -m_floats[2] * v.m_floats[1],
185 m_floats[2] * v.m_floats[0] - m_floats[0] * v.m_floats[2],
186 m_floats[0] * v.m_floats[1] - m_floats[1] * v.m_floats[0]);
191 return m_floats[0] * (v1.m_floats[1] * v2.m_floats[2] - v1.m_floats[2] * v2.m_floats[1]) +
192 m_floats[1] * (v1.m_floats[2] * v2.m_floats[0] - v1.m_floats[0] * v2.m_floats[2]) +
193 m_floats[2] * (v1.m_floats[0] * v2.m_floats[1] - v1.m_floats[1] * v2.m_floats[0]);
200 return m_floats[0] < m_floats[1] ? (m_floats[0] <m_floats[2] ? 0 : 2) : (m_floats[1] <m_floats[2] ? 1 : 2);
207 return m_floats[0] < m_floats[1] ? (m_floats[1] <m_floats[2] ? 2 : 1) : (m_floats[0] <m_floats[2] ? 2 : 0);
212 return absolute().minAxis();
217 return absolute().maxAxis();
223 m_floats[0] = s * v0.m_floats[0] + rt * v1.m_floats[0];
224 m_floats[1] = s * v0.m_floats[1] + rt * v1.m_floats[1];
225 m_floats[2] = s * v0.m_floats[2] + rt * v1.m_floats[2];
235 return Vector3(m_floats[0] + (v.m_floats[0] - m_floats[0]) * t,
236 m_floats[1] + (v.m_floats[1] - m_floats[1]) * t,
237 m_floats[2] + (v.m_floats[2] -m_floats[2]) * t);
244 m_floats[0] *= v.m_floats[0]; m_floats[1] *= v.m_floats[1];m_floats[2] *= v.m_floats[2];
279 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]));
284 return !(*
this == other);
292 tf2SetMax(m_floats[0], other.m_floats[0]);
293 tf2SetMax(m_floats[1], other.m_floats[1]);
294 tf2SetMax(m_floats[2], other.m_floats[2]);
302 tf2SetMin(m_floats[0], other.m_floats[0]);
303 tf2SetMin(m_floats[1], other.m_floats[1]);
304 tf2SetMin(m_floats[2], other.m_floats[2]);
316 void getSkewSymmetricMatrix(Vector3* v0,Vector3* v1,Vector3* v2)
const
318 v0->setValue(0. ,-z() ,y());
319 v1->setValue(z() ,0. ,-x());
320 v2->setValue(-y() ,x() ,0.);
356 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]);
363 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]);
370 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]);
376 return Vector3(-v.m_floats[0], -v.m_floats[1], -v.m_floats[2]);
383 return Vector3(v.m_floats[0] * s, v.m_floats[1] * s, v.m_floats[2] * s);
405 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]);
410 tf2Dot(
const Vector3& v1,
const Vector3& v2)
420 return v1.distance2(v2);
428 return v1.distance(v2);
446 tf2Triple(
const Vector3& v1,
const Vector3& v2,
const Vector3& v3)
448 return v1.triple(v2, v3);
458 return v1.lerp(v2, t);
465 return (v - *
this).length2();
470 return (v - *
this).length();
482 Vector3 o = wAxis * wAxis.dot( *
this );
483 Vector3 x = *
this - o;
486 y = wAxis.cross( *
this );
523 if (m_floats[0] > maxVal)
526 maxVal = m_floats[0];
528 if (m_floats[1] > maxVal)
531 maxVal = m_floats[1];
533 if (m_floats[2] > maxVal)
538 if (m_floats[3] > maxVal)
555 if (m_floats[0] < minVal)
558 minVal = m_floats[0];
560 if (m_floats[1] < minVal)
563 minVal = m_floats[1];
565 if (m_floats[2] < minVal)
570 if (m_floats[3] < minVal)
623 unsigned char* dest = (
unsigned char*) &destVal;
624 const unsigned char* src = (
const unsigned char*) &sourceVal;
637 for (
int i=0;i<4;i++)
649 for (
int i=0;i<4;i++)
662 p.setValue(0,-n[2]*k,n[1]*k);
664 q.setValue(a*k,-n[0]*p[2],n[0]*p[1]);
670 p.setValue(-n.y()*k,n.x()*k,0);
672 q.setValue(-n.z()*p.y(),n.z()*p.x(),a*k);
691 for (
int i=0;i<4;i++)
692 dataOut.
m_floats[i] =
float(m_floats[i]);
697 for (
int i=0;i<4;i++)
698 m_floats[i] =
tf2Scalar(dataIn.m_floats[i]);
705 for (
int i=0;i<4;i++)
706 dataOut.m_floats[i] =
double(m_floats[i]);
711 for (
int i=0;i<4;i++)
712 m_floats[i] =
tf2Scalar(dataIn.m_floats[i]);
719 for (
int i=0;i<4;i++)
720 dataOut.m_floats[i] = m_floats[i];
725 for (
int i=0;i<4;i++)
726 m_floats[i] = dataIn.m_floats[i];
731 #endif //TF2_VECTOR3_H