btVector3.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/
3 
4 This software is provided 'as-is', without any express or implied warranty.
5 In no event will the authors be held liable for any damages arising from the use of this software.
6 Permission is granted to anyone to use this software for any purpose,
7 including commercial applications, and to alter it and redistribute it freely,
8 subject to the following restrictions:
9 
10 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.
11 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
12 3. This notice may not be removed or altered from any source distribution.
13 */
14 
15 #ifndef BT_VECTOR3_H
16 #define BT_VECTOR3_H
17 
18 #include "btMinMax.h"
19 #include "btScalar.h"
20 
21 #ifdef BT_USE_DOUBLE_PRECISION
22 #define btVector3Data btVector3DoubleData
23 #define btVector3DataName "btVector3DoubleData"
24 #else
25 #define btVector3Data btVector3FloatData
26 #define btVector3DataName "btVector3FloatData"
27 #endif //BT_USE_DOUBLE_PRECISION
28 
35 {
36 public:
37 #if defined(__SPU__) && defined(__CELLOS_LV2__)
38  btScalar m_floats[4];
39 
40 public:
41  SIMD_FORCE_INLINE const vec_float4& get128() const
42  {
43  return *((const vec_float4*)&m_floats[0]);
44  }
45 
46 public:
47 #else //__CELLOS_LV2__ __SPU__
48 #ifdef BT_USE_SSE // _WIN32
49  union {
50  __m128 mVec128;
51  btScalar m_floats[4];
52  };
53  SIMD_FORCE_INLINE __m128 get128() const
54  {
55  return mVec128;
56  }
57  SIMD_FORCE_INLINE void set128(__m128 v128)
58  {
59  mVec128 = v128;
60  }
61 #else
62  btScalar m_floats[4];
63 #endif
64 #endif //__CELLOS_LV2__ __SPU__
65 
66 public:
69 
76  {
77  m_floats[0] = x;
78  m_floats[1] = y;
79  m_floats[2] = z;
80  m_floats[3] = btScalar(0.);
81  }
82 
86  {
87 
88  m_floats[0] += v.m_floats[0];
89  m_floats[1] += v.m_floats[1];
90  m_floats[2] += v.m_floats[2];
91  return *this;
92  }
93 
97  {
98  m_floats[0] -= v.m_floats[0];
99  m_floats[1] -= v.m_floats[1];
100  m_floats[2] -= v.m_floats[2];
101  return *this;
102  }
106  {
107  m_floats[0] *= s;
108  m_floats[1] *= s;
109  m_floats[2] *= s;
110  return *this;
111  }
112 
116  {
117  btFullAssert(s != btScalar(0.0));
118  return * this *= btScalar(1.0) / s;
119  }
120 
124  {
125  return m_floats[0] * v.m_floats[0] + m_floats[1] * v.m_floats[1] + m_floats[2] * v.m_floats[2];
126  }
127 
130  {
131  return dot(*this);
132  }
133 
136  {
137  return btSqrt(length2());
138  }
139 
143 
147 
149  {
150  btVector3 absVec = this->absolute();
151  int32_t maxIndex = absVec.maxAxis();
152  if (absVec[maxIndex] > 0) {
153  *this /= absVec[maxIndex];
154  return * this /= length();
155  }
156  setValue(1, 0, 0);
157  return *this;
158  }
159 
163  {
164  return * this /= length();
165  }
166 
169 
173  SIMD_FORCE_INLINE btVector3 rotate(const btVector3& wAxis, const btScalar angle) const;
174 
178  {
179  btScalar s = btSqrt(length2() * v.length2());
180  btFullAssert(s != btScalar(0.0));
181  return btAcos(dot(v) / s);
182  }
185  {
186  return btVector3(
187  btFabs(m_floats[0]),
188  btFabs(m_floats[1]),
189  btFabs(m_floats[2]));
190  }
194  {
195  return btVector3(
196  m_floats[1] * v.m_floats[2] - m_floats[2] * v.m_floats[1],
197  m_floats[2] * v.m_floats[0] - m_floats[0] * v.m_floats[2],
198  m_floats[0] * v.m_floats[1] - m_floats[1] * v.m_floats[0]);
199  }
200 
202  {
203  return m_floats[0] * (v1.m_floats[1] * v2.m_floats[2] - v1.m_floats[2] * v2.m_floats[1]) + m_floats[1] * (v1.m_floats[2] * v2.m_floats[0] - v1.m_floats[0] * v2.m_floats[2]) + m_floats[2] * (v1.m_floats[0] * v2.m_floats[1] - v1.m_floats[1] * v2.m_floats[0]);
204  }
205 
208  SIMD_FORCE_INLINE int32_t minAxis() const
209  {
210  return m_floats[0] < m_floats[1] ? (m_floats[0] < m_floats[2] ? 0 : 2) : (m_floats[1] < m_floats[2] ? 1 : 2);
211  }
212 
215  SIMD_FORCE_INLINE int32_t maxAxis() const
216  {
217  return m_floats[0] < m_floats[1] ? (m_floats[1] < m_floats[2] ? 2 : 1) : (m_floats[0] < m_floats[2] ? 2 : 0);
218  }
219 
221  {
222  return absolute().minAxis();
223  }
224 
226  {
227  return absolute().maxAxis();
228  }
229 
231  {
232  btScalar s = btScalar(1.0) - rt;
233  m_floats[0] = s * v0.m_floats[0] + rt * v1.m_floats[0];
234  m_floats[1] = s * v0.m_floats[1] + rt * v1.m_floats[1];
235  m_floats[2] = s * v0.m_floats[2] + rt * v1.m_floats[2];
236  //don't do the unused w component
237  // m_co[3] = s * v0[3] + rt * v1[3];
238  }
239 
244  {
245  return btVector3(m_floats[0] + (v.m_floats[0] - m_floats[0]) * t,
246  m_floats[1] + (v.m_floats[1] - m_floats[1]) * t,
247  m_floats[2] + (v.m_floats[2] - m_floats[2]) * t);
248  }
249 
253  {
254  m_floats[0] *= v.m_floats[0];
255  m_floats[1] *= v.m_floats[1];
256  m_floats[2] *= v.m_floats[2];
257  return *this;
258  }
259 
261  SIMD_FORCE_INLINE const btScalar& getX() const { return m_floats[0]; }
263  SIMD_FORCE_INLINE const btScalar& getY() const { return m_floats[1]; }
265  SIMD_FORCE_INLINE const btScalar& getZ() const { return m_floats[2]; }
267  SIMD_FORCE_INLINE void setX(btScalar x) { m_floats[0] = x; };
269  SIMD_FORCE_INLINE void setY(btScalar y) { m_floats[1] = y; };
271  SIMD_FORCE_INLINE void setZ(btScalar z) { m_floats[2] = z; };
273  SIMD_FORCE_INLINE void setW(btScalar w) { m_floats[3] = w; };
275  SIMD_FORCE_INLINE const btScalar& x() const { return m_floats[0]; }
277  SIMD_FORCE_INLINE const btScalar& y() const { return m_floats[1]; }
279  SIMD_FORCE_INLINE const btScalar& z() const { return m_floats[2]; }
281  SIMD_FORCE_INLINE const btScalar& w() const { return m_floats[3]; }
282 
283  //SIMD_FORCE_INLINE btScalar& operator[](int32_t i) { return (&m_floats[0])[i]; }
284  //SIMD_FORCE_INLINE const btScalar& operator[](int32_t i) const { return (&m_floats[0])[i]; }
286  SIMD_FORCE_INLINE operator btScalar*() { return &m_floats[0]; }
287  SIMD_FORCE_INLINE operator const btScalar*() const { return &m_floats[0]; }
288 
289  SIMD_FORCE_INLINE bool operator==(const btVector3& other) const
290  {
291  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]));
292  }
293 
294  SIMD_FORCE_INLINE bool operator!=(const btVector3& other) const
295  {
296  return !(*this == other);
297  }
298 
302  SIMD_FORCE_INLINE void setMax(const btVector3& other)
303  {
304  btSetMax(m_floats[0], other.m_floats[0]);
305  btSetMax(m_floats[1], other.m_floats[1]);
306  btSetMax(m_floats[2], other.m_floats[2]);
307  btSetMax(m_floats[3], other.w());
308  }
312  SIMD_FORCE_INLINE void setMin(const btVector3& other)
313  {
314  btSetMin(m_floats[0], other.m_floats[0]);
315  btSetMin(m_floats[1], other.m_floats[1]);
316  btSetMin(m_floats[2], other.m_floats[2]);
317  btSetMin(m_floats[3], other.w());
318  }
319 
320  SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z)
321  {
322  m_floats[0] = x;
323  m_floats[1] = y;
324  m_floats[2] = z;
325  m_floats[3] = btScalar(0.);
326  }
327 
329  {
330  v0->setValue(0., -z(), y());
331  v1->setValue(z(), 0., -x());
332  v2->setValue(-y(), x(), 0.);
333  }
334 
335  void setZero()
336  {
337  setValue(btScalar(0.), btScalar(0.), btScalar(0.));
338  }
339 
341  {
342  return m_floats[0] == btScalar(0) && m_floats[1] == btScalar(0) && m_floats[2] == btScalar(0);
343  }
344 
346  {
347  return length2() < SIMD_EPSILON;
348  }
349 
350  SIMD_FORCE_INLINE void serialize(struct btVector3Data & dataOut) const;
351 
352  SIMD_FORCE_INLINE void deSerialize(const struct btVector3Data& dataIn);
353 
354  SIMD_FORCE_INLINE void serializeFloat(struct btVector3FloatData & dataOut) const;
355 
356  SIMD_FORCE_INLINE void deSerializeFloat(const struct btVector3FloatData& dataIn);
357 
358  SIMD_FORCE_INLINE void serializeDouble(struct btVector3DoubleData & dataOut) const;
359 
360  SIMD_FORCE_INLINE void deSerializeDouble(const struct btVector3DoubleData& dataIn);
361 };
362 
365 operator+(const btVector3& v1, const btVector3& v2)
366 {
367  return btVector3(v1.m_floats[0] + v2.m_floats[0], v1.m_floats[1] + v2.m_floats[1], v1.m_floats[2] + v2.m_floats[2]);
368 }
369 
372 operator*(const btVector3& v1, const btVector3& v2)
373 {
374  return btVector3(v1.m_floats[0] * v2.m_floats[0], v1.m_floats[1] * v2.m_floats[1], v1.m_floats[2] * v2.m_floats[2]);
375 }
376 
379 operator-(const btVector3& v1, const btVector3& v2)
380 {
381  return btVector3(v1.m_floats[0] - v2.m_floats[0], v1.m_floats[1] - v2.m_floats[1], v1.m_floats[2] - v2.m_floats[2]);
382 }
386 {
387  return btVector3(-v.m_floats[0], -v.m_floats[1], -v.m_floats[2]);
388 }
389 
392 operator*(const btVector3& v, const btScalar& s)
393 {
394  return btVector3(v.m_floats[0] * s, v.m_floats[1] * s, v.m_floats[2] * s);
395 }
396 
399 operator*(const btScalar& s, const btVector3& v)
400 {
401  return v * s;
402 }
403 
406 operator/(const btVector3& v, const btScalar& s)
407 {
408  btFullAssert(s != btScalar(0.0));
409  return v * (btScalar(1.0) / s);
410 }
411 
414 operator/(const btVector3& v1, const btVector3& v2)
415 {
416  return btVector3(v1.m_floats[0] / v2.m_floats[0], v1.m_floats[1] / v2.m_floats[1], v1.m_floats[2] / v2.m_floats[2]);
417 }
418 
421 btDot(const btVector3& v1, const btVector3& v2)
422 {
423  return v1.dot(v2);
424 }
425 
428 btDistance2(const btVector3& v1, const btVector3& v2)
429 {
430  return v1.distance2(v2);
431 }
432 
435 btDistance(const btVector3& v1, const btVector3& v2)
436 {
437  return v1.distance(v2);
438 }
439 
442 btAngle(const btVector3& v1, const btVector3& v2)
443 {
444  return v1.angle(v2);
445 }
446 
449 btCross(const btVector3& v1, const btVector3& v2)
450 {
451  return v1.cross(v2);
452 }
453 
455 btTriple(const btVector3& v1, const btVector3& v2, const btVector3& v3)
456 {
457  return v1.triple(v2, v3);
458 }
459 
465 lerp(const btVector3& v1, const btVector3& v2, const btScalar& t)
466 {
467  return v1.lerp(v2, t);
468 }
469 
471 {
472  return (v - *this).length2();
473 }
474 
476 {
477  return (v - *this).length();
478 }
479 
481 {
482  return *this / length();
483 }
484 
486 {
487  // wAxis must be a unit lenght vector
488 
489  btVector3 o = wAxis * wAxis.dot(*this);
490  btVector3 x = *this - o;
491  btVector3 y;
492 
493  y = wAxis.cross(*this);
494 
495  return (o + x * btCos(angle) + y * btSin(angle));
496 }
497 
498 class btVector4 : public btVector3 {
499 public:
501 
502  SIMD_FORCE_INLINE btVector4(const btScalar& x, const btScalar& y, const btScalar& z, const btScalar& w)
503  : btVector3(x, y, z)
504  {
505  m_floats[3] = w;
506  }
507 
509  {
510  return btVector4(
511  btFabs(m_floats[0]),
512  btFabs(m_floats[1]),
513  btFabs(m_floats[2]),
514  btFabs(m_floats[3]));
515  }
516 
517  btScalar getW() const { return m_floats[3]; }
518 
519  SIMD_FORCE_INLINE int32_t maxAxis4() const
520  {
521  int32_t maxIndex = -1;
522  btScalar maxVal = btScalar(-BT_LARGE_FLOAT);
523  if (m_floats[0] > maxVal) {
524  maxIndex = 0;
525  maxVal = m_floats[0];
526  }
527  if (m_floats[1] > maxVal) {
528  maxIndex = 1;
529  maxVal = m_floats[1];
530  }
531  if (m_floats[2] > maxVal) {
532  maxIndex = 2;
533  maxVal = m_floats[2];
534  }
535  if (m_floats[3] > maxVal) {
536  maxIndex = 3;
537  }
538  return maxIndex;
539  }
540 
541  SIMD_FORCE_INLINE int32_t minAxis4() const
542  {
543  int32_t minIndex = -1;
544  btScalar minVal = btScalar(BT_LARGE_FLOAT);
545  if (m_floats[0] < minVal) {
546  minIndex = 0;
547  minVal = m_floats[0];
548  }
549  if (m_floats[1] < minVal) {
550  minIndex = 1;
551  minVal = m_floats[1];
552  }
553  if (m_floats[2] < minVal) {
554  minIndex = 2;
555  minVal = m_floats[2];
556  }
557  if (m_floats[3] < minVal) {
558  minIndex = 3;
559  }
560 
561  return minIndex;
562  }
563 
565  {
566  return absolute4().maxAxis4();
567  }
568 
575  /* void getValue(btScalar *m) const
576  {
577  m[0] = m_floats[0];
578  m[1] = m_floats[1];
579  m[2] =m_floats[2];
580  }
581 */
588  SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z, const btScalar& w)
589  {
590  m_floats[0] = x;
591  m_floats[1] = y;
592  m_floats[2] = z;
593  m_floats[3] = w;
594  }
595 };
596 
598 SIMD_FORCE_INLINE void btSwapScalarEndian(const btScalar& sourceVal, btScalar& destVal)
599 {
600 #ifdef BT_USE_DOUBLE_PRECISION
601  unsigned char* dest = (unsigned char*)&destVal;
602  unsigned char* src = (unsigned char*)&sourceVal;
603  dest[0] = src[7];
604  dest[1] = src[6];
605  dest[2] = src[5];
606  dest[3] = src[4];
607  dest[4] = src[3];
608  dest[5] = src[2];
609  dest[6] = src[1];
610  dest[7] = src[0];
611 #else
612  unsigned char* dest = (unsigned char*)&destVal;
613  unsigned char* src = (unsigned char*)&sourceVal;
614  dest[0] = src[3];
615  dest[1] = src[2];
616  dest[2] = src[1];
617  dest[3] = src[0];
618 #endif //BT_USE_DOUBLE_PRECISION
619 }
622 {
623  for (int32_t i = 0; i < 4; i++) {
624  btSwapScalarEndian(sourceVec[i], destVec[i]);
625  }
626 }
627 
630 {
631 
632  btVector3 swappedVec;
633  for (int32_t i = 0; i < 4; i++) {
634  btSwapScalarEndian(vector[i], swappedVec[i]);
635  }
636  vector = swappedVec;
637 }
638 
639 template <class T>
640 SIMD_FORCE_INLINE void btPlaneSpace1(const T& n, T& p, T& q)
641 {
642  if (btFabs(n[2]) > SIMDSQRT12) {
643  // choose p in y-z plane
644  btScalar a = n[1] * n[1] + n[2] * n[2];
645  btScalar k = btRecipSqrt(a);
646  p[0] = 0;
647  p[1] = -n[2] * k;
648  p[2] = n[1] * k;
649  // set q = n x p
650  q[0] = a * k;
651  q[1] = -n[0] * p[2];
652  q[2] = n[0] * p[1];
653  }
654  else {
655  // choose p in x-y plane
656  btScalar a = n[0] * n[0] + n[1] * n[1];
657  btScalar k = btRecipSqrt(a);
658  p[0] = -n[1] * k;
659  p[1] = n[0] * k;
660  p[2] = 0;
661  // set q = n x p
662  q[0] = -n[2] * p[1];
663  q[1] = n[2] * p[0];
664  q[2] = a * k;
665  }
666 }
667 
669  float m_floats[4];
670 };
671 
673  double m_floats[4];
674 };
675 
677 {
679  for (int32_t i = 0; i < 4; i++)
680  dataOut.m_floats[i] = float(m_floats[i]);
681 }
682 
684 {
685  for (int32_t i = 0; i < 4; i++)
686  m_floats[i] = btScalar(dataIn.m_floats[i]);
687 }
688 
690 {
692  for (int32_t i = 0; i < 4; i++)
693  dataOut.m_floats[i] = double(m_floats[i]);
694 }
695 
697 {
698  for (int32_t i = 0; i < 4; i++)
699  m_floats[i] = btScalar(dataIn.m_floats[i]);
700 }
701 
702 SIMD_FORCE_INLINE void btVector3::serialize(struct btVector3Data& dataOut) const
703 {
705  for (int32_t i = 0; i < 4; i++)
706  dataOut.m_floats[i] = m_floats[i];
707 }
708 
710 {
711  for (int32_t i = 0; i < 4; i++)
712  m_floats[i] = dataIn.m_floats[i];
713 }
714 
715 #endif //BT_VECTOR3_H
SIMD_FORCE_INLINE bool operator==(const btVector3 &other) const
Definition: btVector3.h:289
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:178
SIMD_FORCE_INLINE void btSetMax(T &a, const T &b)
Definition: btMinMax.h:47
SIMD_FORCE_INLINE void serialize(struct btVector3Data &dataOut) const
SIMD_FORCE_INLINE void setZ(btScalar z)
Set the z value.
Definition: btVector3.h:271
SIMD_FORCE_INLINE btVector3 lerp(const btVector3 &v, const btScalar &t) const
Return the linear interpolation between this and another vector.
Definition: btVector3.h:243
SIMD_FORCE_INLINE void btSetMin(T &a, const T &b)
Definition: btMinMax.h:39
SIMD_FORCE_INLINE btScalar btDistance(const btVector3 &v1, const btVector3 &v2)
Return the distance between two vectors.
Definition: btVector3.h:435
Definition: btVector3.h:672
SIMD_FORCE_INLINE int32_t minAxis() const
Return the axis with the smallest value Note return values are 0,1,2 for x, y, or z...
Definition: btVector3.h:208
SIMD_FORCE_INLINE btScalar dot(const btVector3 &v) const
Return the dot product.
Definition: btVector3.h:123
#define SIMD_EPSILON
Definition: btScalar.h:320
SIMD_FORCE_INLINE void serializeFloat(struct btVector3FloatData &dataOut) const
Definition: btVector3.h:676
SIMD_FORCE_INLINE btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
Definition: btVector3.h:162
SIMD_FORCE_INLINE void setInterpolate3(const btVector3 &v0, const btVector3 &v1, btScalar rt)
Definition: btVector3.h:230
SIMD_FORCE_INLINE const btScalar & x() const
Return the x value.
Definition: btVector3.h:275
SIMD_FORCE_INLINE void setY(btScalar y)
Set the y value.
Definition: btVector3.h:269
SIMD_FORCE_INLINE void setValue(const btScalar &x, const btScalar &y, const btScalar &z, const btScalar &w)
Set x,y,z and zero w.
Definition: btVector3.h:588
void setZero()
Definition: btVector3.h:335
SIMD_FORCE_INLINE void btUnSwapVector3Endian(btVector3 &vector)
btUnSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization ...
Definition: btVector3.h:629
SIMD_FORCE_INLINE btScalar btAcos(btScalar x)
Definition: btScalar.h:282
SIMD_FORCE_INLINE void serializeDouble(struct btVector3DoubleData &dataOut) const
Definition: btVector3.h:689
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:35
SIMD_FORCE_INLINE void deSerializeFloat(const struct btVector3FloatData &dataIn)
Definition: btVector3.h:683
SIMD_FORCE_INLINE btVector3 rotate(const btVector3 &wAxis, const btScalar angle) const
Return a rotated version of this vector.
Definition: btVector3.h:485
SIMD_FORCE_INLINE void setMin(const btVector3 &other)
Set each element to the min of the current values and the values of another btVector3.
Definition: btVector3.h:312
SIMD_FORCE_INLINE int32_t maxAxis4() const
Definition: btVector3.h:519
SIMD_FORCE_INLINE btScalar btFabs(btScalar x)
Definition: btScalar.h:278
SIMD_FORCE_INLINE void setX(btScalar x)
Set the x value.
Definition: btVector3.h:267
#define SIMDSQRT12
Definition: btScalar.h:312
SIMD_FORCE_INLINE btScalar btDistance2(const btVector3 &v1, const btVector3 &v2)
Return the distance squared between two vectors.
Definition: btVector3.h:428
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:208
SIMD_FORCE_INLINE btVector4(const btScalar &x, const btScalar &y, const btScalar &z, const btScalar &w)
Definition: btVector3.h:502
#define btRecipSqrt(x)
Definition: btScalar.h:314
SIMD_FORCE_INLINE btScalar btCos(btScalar x)
Definition: btScalar.h:279
SIMD_FORCE_INLINE btVector3 absolute() const
Return a vector will the absolute values of each element.
Definition: btVector3.h:184
SIMD_FORCE_INLINE btVector3 & operator*=(const btScalar &s)
Scale the vector.
Definition: btVector3.h:105
SIMD_FORCE_INLINE void setMax(const btVector3 &other)
Set each element to the max of the current values and the values of another btVector3.
Definition: btVector3.h:302
SIMD_FORCE_INLINE const btScalar & y() const
Return the y value.
Definition: btVector3.h:277
float m_floats[4]
Definition: btVector3.h:669
Definition: btVector3.h:668
SIMD_FORCE_INLINE btVector3 operator*(const btVector3 &v1, const btVector3 &v2)
Return the elementwise product of two vectors.
Definition: btVector3.h:372
SIMD_FORCE_INLINE int32_t minAxis4() const
Definition: btVector3.h:541
SIMD_FORCE_INLINE int32_t maxAxis() const
Return the axis with the largest value Note return values are 0,1,2 for x, y, or z.
Definition: btVector3.h:215
SIMD_FORCE_INLINE btVector4 absolute4() const
Definition: btVector3.h:508
SIMD_FORCE_INLINE void btSwapScalarEndian(const btScalar &sourceVal, btScalar &destVal)
btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization ...
Definition: btVector3.h:598
SIMD_FORCE_INLINE void btSwapVector3Endian(const btVector3 &sourceVec, btVector3 &destVec)
btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization ...
Definition: btVector3.h:621
SIMD_FORCE_INLINE bool fuzzyZero() const
Definition: btVector3.h:345
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:177
SIMD_FORCE_INLINE btScalar btSin(btScalar x)
Definition: btScalar.h:280
SIMD_FORCE_INLINE btVector3 & operator+=(const btVector3 &v)
Add a vector to this one.
Definition: btVector3.h:85
SIMD_FORCE_INLINE btVector3 & operator/=(const btScalar &s)
Inversely scale the vector.
Definition: btVector3.h:115
void getSkewSymmetricMatrix(btVector3 *v0, btVector3 *v1, btVector3 *v2) const
Definition: btVector3.h:328
SIMD_FORCE_INLINE btVector3 btCross(const btVector3 &v1, const btVector3 &v2)
Return the cross product of two vectors.
Definition: btVector3.h:449
SIMD_FORCE_INLINE btVector3 operator-(const btVector3 &v1, const btVector3 &v2)
Return the difference between two vectors.
Definition: btVector3.h:379
SIMD_FORCE_INLINE btVector3 operator+(const btVector3 &v1, const btVector3 &v2)
Return the sum of two vectors (Point symantics)
Definition: btVector3.h:365
SIMD_FORCE_INLINE void deSerialize(const struct btVector3Data &dataIn)
Definition: btVector3.h:709
double m_floats[4]
Definition: btVector3.h:673
#define btFullAssert(x)
Definition: btScalar.h:192
SIMD_FORCE_INLINE btScalar btTriple(const btVector3 &v1, const btVector3 &v2, const btVector3 &v3)
Definition: btVector3.h:455
SIMD_FORCE_INLINE int32_t closestAxis() const
Definition: btVector3.h:225
SIMD_FORCE_INLINE btVector3 & safeNormalize()
Definition: btVector3.h:148
SIMD_FORCE_INLINE btVector3 & operator-=(const btVector3 &v)
Subtract a vector from this one.
Definition: btVector3.h:96
SIMD_FORCE_INLINE btVector3 normalized() const
Return a normalized version of this vector.
Definition: btVector3.h:480
btScalar getW() const
Definition: btVector3.h:517
#define SIMD_FORCE_INLINE
Definition: btScalar.h:173
SIMD_FORCE_INLINE btVector3 operator/(const btVector3 &v, const btScalar &s)
Return the vector inversely scaled by s.
Definition: btVector3.h:406
SIMD_FORCE_INLINE void setValue(const btScalar &x, const btScalar &y, const btScalar &z)
Definition: btVector3.h:320
SIMD_FORCE_INLINE btVector4()
Definition: btVector3.h:500
SIMD_FORCE_INLINE btScalar length2() const
Return the length of the vector squared.
Definition: btVector3.h:129
SIMD_FORCE_INLINE btScalar distance(const btVector3 &v) const
Return the distance between the ends of this and another vector This is symantically treating the vec...
Definition: btVector3.h:475
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
Definition: btVector3.h:135
SIMD_FORCE_INLINE btScalar triple(const btVector3 &v1, const btVector3 &v2) const
Definition: btVector3.h:201
SIMD_FORCE_INLINE void deSerializeDouble(const struct btVector3DoubleData &dataIn)
Definition: btVector3.h:696
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition: btVector3.h:279
SIMD_FORCE_INLINE bool operator!=(const btVector3 &other) const
Definition: btVector3.h:294
#define BT_LARGE_FLOAT
Definition: btScalar.h:210
SIMD_FORCE_INLINE void btPlaneSpace1(const T &n, T &p, T &q)
Definition: btVector3.h:640
SIMD_FORCE_INLINE void setW(btScalar w)
Set the w value.
Definition: btVector3.h:273
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btVector3.h:281
SIMD_FORCE_INLINE btScalar btAngle(const btVector3 &v1, const btVector3 &v2)
Return the angle between two vectors.
Definition: btVector3.h:442
#define btVector3Data
Definition: btVector3.h:25
SIMD_FORCE_INLINE const btScalar & getZ() const
Return the z value.
Definition: btVector3.h:265
SIMD_FORCE_INLINE btScalar btSqrt(btScalar y)
Definition: btScalar.h:258
SIMD_FORCE_INLINE const btScalar & getY() const
Return the y value.
Definition: btVector3.h:263
SIMD_FORCE_INLINE int32_t closestAxis4() const
Definition: btVector3.h:564
SIMD_FORCE_INLINE bool isZero() const
Definition: btVector3.h:340
SIMD_FORCE_INLINE btScalar distance2(const btVector3 &v) const
Return the distance squared between the ends of this and another vector This is symantically treating...
Definition: btVector3.h:470
Definition: btVector3.h:498
SIMD_FORCE_INLINE btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
Definition: btVector3.h:193
SIMD_FORCE_INLINE int32_t furthestAxis() const
Definition: btVector3.h:220
SIMD_FORCE_INLINE btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
Definition: btVector3.h:421
SIMD_FORCE_INLINE const btScalar & getX() const
Return the x value.
Definition: btVector3.h:261