b2Math.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * 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
9 * freely, subject to the following restrictions:
10 * 1. The origin of this software must not be misrepresented; you must not
11 * claim that you wrote the original software. If you use this software
12 * in a product, an acknowledgment in the product documentation would be
13 * appreciated but is not required.
14 * 2. Altered source versions must be plainly marked as such, and must not be
15 * misrepresented as being the original software.
16 * 3. This notice may not be removed or altered from any source distribution.
17 */
18 
19 #ifndef B2_MATH_H
20 #define B2_MATH_H
21 
23 #include <math.h>
24 
26 inline bool b2IsValid(float32 x)
27 {
28  return std::isfinite(x);
29 }
30 
33 {
34  union
35  {
36  float32 x;
37  int32 i;
38  } convert;
39 
40  convert.x = x;
41  float32 xhalf = 0.5f * x;
42  convert.i = 0x5f3759df - (convert.i >> 1);
43  x = convert.x;
44  x = x * (1.5f - xhalf * x * x);
45  return x;
46 }
47 
48 #define b2Sqrt(x) sqrtf(x)
49 #define b2Atan2(y, x) atan2f(y, x)
50 
52 struct b2Vec2
53 {
55  b2Vec2() {}
56 
58  b2Vec2(float32 x, float32 y) : x(x), y(y) {}
59 
61  void SetZero() { x = 0.0f; y = 0.0f; }
62 
64  void Set(float32 x_, float32 y_) { x = x_; y = y_; }
65 
67  b2Vec2 operator -() const { b2Vec2 v; v.Set(-x, -y); return v; }
68 
71  {
72  return (&x)[i];
73  }
74 
77  {
78  return (&x)[i];
79  }
80 
82  void operator += (const b2Vec2& v)
83  {
84  x += v.x; y += v.y;
85  }
86 
88  void operator -= (const b2Vec2& v)
89  {
90  x -= v.x; y -= v.y;
91  }
92 
95  {
96  x *= a; y *= a;
97  }
98 
100  float32 Length() const
101  {
102  return b2Sqrt(x * x + y * y);
103  }
104 
108  {
109  return x * x + y * y;
110  }
111 
114  {
115  float32 length = Length();
116  if (length < b2_epsilon)
117  {
118  return 0.0f;
119  }
120  float32 invLength = 1.0f / length;
121  x *= invLength;
122  y *= invLength;
123 
124  return length;
125  }
126 
128  bool IsValid() const
129  {
130  return b2IsValid(x) && b2IsValid(y);
131  }
132 
134  b2Vec2 Skew() const
135  {
136  return b2Vec2(-y, x);
137  }
138 
140 };
141 
143 struct b2Vec3
144 {
146  b2Vec3() {}
147 
149  b2Vec3(float32 x, float32 y, float32 z) : x(x), y(y), z(z) {}
150 
152  void SetZero() { x = 0.0f; y = 0.0f; z = 0.0f; }
153 
155  void Set(float32 x_, float32 y_, float32 z_) { x = x_; y = y_; z = z_; }
156 
158  b2Vec3 operator -() const { b2Vec3 v; v.Set(-x, -y, -z); return v; }
159 
161  void operator += (const b2Vec3& v)
162  {
163  x += v.x; y += v.y; z += v.z;
164  }
165 
167  void operator -= (const b2Vec3& v)
168  {
169  x -= v.x; y -= v.y; z -= v.z;
170  }
171 
174  {
175  x *= s; y *= s; z *= s;
176  }
177 
179 };
180 
182 struct b2Mat22
183 {
185  b2Mat22() {}
186 
188  b2Mat22(const b2Vec2& c1, const b2Vec2& c2)
189  {
190  ex = c1;
191  ey = c2;
192  }
193 
195  b2Mat22(float32 a11, float32 a12, float32 a21, float32 a22)
196  {
197  ex.x = a11; ex.y = a21;
198  ey.x = a12; ey.y = a22;
199  }
200 
202  void Set(const b2Vec2& c1, const b2Vec2& c2)
203  {
204  ex = c1;
205  ey = c2;
206  }
207 
209  void SetIdentity()
210  {
211  ex.x = 1.0f; ey.x = 0.0f;
212  ex.y = 0.0f; ey.y = 1.0f;
213  }
214 
216  void SetZero()
217  {
218  ex.x = 0.0f; ey.x = 0.0f;
219  ex.y = 0.0f; ey.y = 0.0f;
220  }
221 
223  {
224  float32 a = ex.x, b = ey.x, c = ex.y, d = ey.y;
225  b2Mat22 B;
226  float32 det = a * d - b * c;
227  if (det != 0.0f)
228  {
229  det = 1.0f / det;
230  }
231  B.ex.x = det * d; B.ey.x = -det * b;
232  B.ex.y = -det * c; B.ey.y = det * a;
233  return B;
234  }
235 
238  b2Vec2 Solve(const b2Vec2& b) const
239  {
240  float32 a11 = ex.x, a12 = ey.x, a21 = ex.y, a22 = ey.y;
241  float32 det = a11 * a22 - a12 * a21;
242  if (det != 0.0f)
243  {
244  det = 1.0f / det;
245  }
246  b2Vec2 x;
247  x.x = det * (a22 * b.x - a12 * b.y);
248  x.y = det * (a11 * b.y - a21 * b.x);
249  return x;
250  }
251 
252  b2Vec2 ex, ey;
253 };
254 
256 struct b2Mat33
257 {
259  b2Mat33() {}
260 
262  b2Mat33(const b2Vec3& c1, const b2Vec3& c2, const b2Vec3& c3)
263  {
264  ex = c1;
265  ey = c2;
266  ez = c3;
267  }
268 
270  void SetZero()
271  {
272  ex.SetZero();
273  ey.SetZero();
274  ez.SetZero();
275  }
276 
279  b2Vec3 Solve33(const b2Vec3& b) const;
280 
284  b2Vec2 Solve22(const b2Vec2& b) const;
285 
288  void GetInverse22(b2Mat33* M) const;
289 
292  void GetSymInverse33(b2Mat33* M) const;
293 
294  b2Vec3 ex, ey, ez;
295 };
296 
298 struct b2Rot
299 {
300  b2Rot() {}
301 
303  explicit b2Rot(float32 angle)
304  {
306  s = sinf(angle);
307  c = cosf(angle);
308  }
309 
312  {
314  s = sinf(angle);
315  c = cosf(angle);
316  }
317 
319  void SetIdentity()
320  {
321  s = 0.0f;
322  c = 1.0f;
323  }
324 
327  {
328  return b2Atan2(s, c);
329  }
330 
332  b2Vec2 GetXAxis() const
333  {
334  return b2Vec2(c, s);
335  }
336 
338  b2Vec2 GetYAxis() const
339  {
340  return b2Vec2(-s, c);
341  }
342 
345 };
346 
350 {
353 
355  b2Transform(const b2Vec2& position, const b2Rot& rotation) : p(position), q(rotation) {}
356 
358  void SetIdentity()
359  {
360  p.SetZero();
361  q.SetIdentity();
362  }
363 
365  void Set(const b2Vec2& position, float32 angle)
366  {
367  p = position;
368  q.Set(angle);
369  }
370 
373 };
374 
379 struct b2Sweep
380 {
383  void GetTransform(b2Transform* xfb, float32 beta) const;
384 
387  void Advance(float32 alpha);
388 
390  void Normalize();
391 
395 
399 };
400 
402 extern const b2Vec2 b2Vec2_zero;
403 
405 inline float32 b2Dot(const b2Vec2& a, const b2Vec2& b)
406 {
407  return a.x * b.x + a.y * b.y;
408 }
409 
411 inline float32 b2Cross(const b2Vec2& a, const b2Vec2& b)
412 {
413  return a.x * b.y - a.y * b.x;
414 }
415 
418 inline b2Vec2 b2Cross(const b2Vec2& a, float32 s)
419 {
420  return b2Vec2(s * a.y, -s * a.x);
421 }
422 
425 inline b2Vec2 b2Cross(float32 s, const b2Vec2& a)
426 {
427  return b2Vec2(-s * a.y, s * a.x);
428 }
429 
432 inline b2Vec2 b2Mul(const b2Mat22& A, const b2Vec2& v)
433 {
434  return b2Vec2(A.ex.x * v.x + A.ey.x * v.y, A.ex.y * v.x + A.ey.y * v.y);
435 }
436 
439 inline b2Vec2 b2MulT(const b2Mat22& A, const b2Vec2& v)
440 {
441  return b2Vec2(b2Dot(v, A.ex), b2Dot(v, A.ey));
442 }
443 
445 inline b2Vec2 operator + (const b2Vec2& a, const b2Vec2& b)
446 {
447  return b2Vec2(a.x + b.x, a.y + b.y);
448 }
449 
451 inline b2Vec2 operator - (const b2Vec2& a, const b2Vec2& b)
452 {
453  return b2Vec2(a.x - b.x, a.y - b.y);
454 }
455 
457 {
458  return b2Vec2(s * a.x, s * a.y);
459 }
460 
461 inline bool operator == (const b2Vec2& a, const b2Vec2& b)
462 {
463  return a.x == b.x && a.y == b.y;
464 }
465 
466 inline float32 b2Distance(const b2Vec2& a, const b2Vec2& b)
467 {
468  b2Vec2 c = a - b;
469  return c.Length();
470 }
471 
472 inline float32 b2DistanceSquared(const b2Vec2& a, const b2Vec2& b)
473 {
474  b2Vec2 c = a - b;
475  return b2Dot(c, c);
476 }
477 
479 {
480  return b2Vec3(s * a.x, s * a.y, s * a.z);
481 }
482 
484 inline b2Vec3 operator + (const b2Vec3& a, const b2Vec3& b)
485 {
486  return b2Vec3(a.x + b.x, a.y + b.y, a.z + b.z);
487 }
488 
490 inline b2Vec3 operator - (const b2Vec3& a, const b2Vec3& b)
491 {
492  return b2Vec3(a.x - b.x, a.y - b.y, a.z - b.z);
493 }
494 
496 inline float32 b2Dot(const b2Vec3& a, const b2Vec3& b)
497 {
498  return a.x * b.x + a.y * b.y + a.z * b.z;
499 }
500 
502 inline b2Vec3 b2Cross(const b2Vec3& a, const b2Vec3& b)
503 {
504  return b2Vec3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
505 }
506 
507 inline b2Mat22 operator + (const b2Mat22& A, const b2Mat22& B)
508 {
509  return b2Mat22(A.ex + B.ex, A.ey + B.ey);
510 }
511 
512 // A * B
513 inline b2Mat22 b2Mul(const b2Mat22& A, const b2Mat22& B)
514 {
515  return b2Mat22(b2Mul(A, B.ex), b2Mul(A, B.ey));
516 }
517 
518 // A^T * B
519 inline b2Mat22 b2MulT(const b2Mat22& A, const b2Mat22& B)
520 {
521  b2Vec2 c1(b2Dot(A.ex, B.ex), b2Dot(A.ey, B.ex));
522  b2Vec2 c2(b2Dot(A.ex, B.ey), b2Dot(A.ey, B.ey));
523  return b2Mat22(c1, c2);
524 }
525 
527 inline b2Vec3 b2Mul(const b2Mat33& A, const b2Vec3& v)
528 {
529  return v.x * A.ex + v.y * A.ey + v.z * A.ez;
530 }
531 
533 inline b2Vec2 b2Mul22(const b2Mat33& A, const b2Vec2& v)
534 {
535  return b2Vec2(A.ex.x * v.x + A.ey.x * v.y, A.ex.y * v.x + A.ey.y * v.y);
536 }
537 
539 inline b2Rot b2Mul(const b2Rot& q, const b2Rot& r)
540 {
541  // [qc -qs] * [rc -rs] = [qc*rc-qs*rs -qc*rs-qs*rc]
542  // [qs qc] [rs rc] [qs*rc+qc*rs -qs*rs+qc*rc]
543  // s = qs * rc + qc * rs
544  // c = qc * rc - qs * rs
545  b2Rot qr;
546  qr.s = q.s * r.c + q.c * r.s;
547  qr.c = q.c * r.c - q.s * r.s;
548  return qr;
549 }
550 
552 inline b2Rot b2MulT(const b2Rot& q, const b2Rot& r)
553 {
554  // [ qc qs] * [rc -rs] = [qc*rc+qs*rs -qc*rs+qs*rc]
555  // [-qs qc] [rs rc] [-qs*rc+qc*rs qs*rs+qc*rc]
556  // s = qc * rs - qs * rc
557  // c = qc * rc + qs * rs
558  b2Rot qr;
559  qr.s = q.c * r.s - q.s * r.c;
560  qr.c = q.c * r.c + q.s * r.s;
561  return qr;
562 }
563 
565 inline b2Vec2 b2Mul(const b2Rot& q, const b2Vec2& v)
566 {
567  return b2Vec2(q.c * v.x - q.s * v.y, q.s * v.x + q.c * v.y);
568 }
569 
571 inline b2Vec2 b2MulT(const b2Rot& q, const b2Vec2& v)
572 {
573  return b2Vec2(q.c * v.x + q.s * v.y, -q.s * v.x + q.c * v.y);
574 }
575 
576 inline b2Vec2 b2Mul(const b2Transform& T, const b2Vec2& v)
577 {
578  float32 x = (T.q.c * v.x - T.q.s * v.y) + T.p.x;
579  float32 y = (T.q.s * v.x + T.q.c * v.y) + T.p.y;
580 
581  return b2Vec2(x, y);
582 }
583 
584 inline b2Vec2 b2MulT(const b2Transform& T, const b2Vec2& v)
585 {
586  float32 px = v.x - T.p.x;
587  float32 py = v.y - T.p.y;
588  float32 x = (T.q.c * px + T.q.s * py);
589  float32 y = (-T.q.s * px + T.q.c * py);
590 
591  return b2Vec2(x, y);
592 }
593 
594 // v2 = A.q.Rot(B.q.Rot(v1) + B.p) + A.p
595 // = (A.q * B.q).Rot(v1) + A.q.Rot(B.p) + A.p
596 inline b2Transform b2Mul(const b2Transform& A, const b2Transform& B)
597 {
598  b2Transform C;
599  C.q = b2Mul(A.q, B.q);
600  C.p = b2Mul(A.q, B.p) + A.p;
601  return C;
602 }
603 
604 // v2 = A.q' * (B.q * v1 + B.p - A.p)
605 // = A.q' * B.q * v1 + A.q' * (B.p - A.p)
606 inline b2Transform b2MulT(const b2Transform& A, const b2Transform& B)
607 {
608  b2Transform C;
609  C.q = b2MulT(A.q, B.q);
610  C.p = b2MulT(A.q, B.p - A.p);
611  return C;
612 }
613 
614 template <typename T>
615 inline T b2Abs(T a)
616 {
617  return a > T(0) ? a : -a;
618 }
619 
620 inline b2Vec2 b2Abs(const b2Vec2& a)
621 {
622  return b2Vec2(b2Abs(a.x), b2Abs(a.y));
623 }
624 
625 inline b2Mat22 b2Abs(const b2Mat22& A)
626 {
627  return b2Mat22(b2Abs(A.ex), b2Abs(A.ey));
628 }
629 
630 template <typename T>
631 inline T b2Min(T a, T b)
632 {
633  return a < b ? a : b;
634 }
635 
636 inline b2Vec2 b2Min(const b2Vec2& a, const b2Vec2& b)
637 {
638  return b2Vec2(b2Min(a.x, b.x), b2Min(a.y, b.y));
639 }
640 
641 template <typename T>
642 inline T b2Max(T a, T b)
643 {
644  return a > b ? a : b;
645 }
646 
647 inline b2Vec2 b2Max(const b2Vec2& a, const b2Vec2& b)
648 {
649  return b2Vec2(b2Max(a.x, b.x), b2Max(a.y, b.y));
650 }
651 
652 template <typename T>
653 inline T b2Clamp(T a, T low, T high)
654 {
655  return b2Max(low, b2Min(a, high));
656 }
657 
658 inline b2Vec2 b2Clamp(const b2Vec2& a, const b2Vec2& low, const b2Vec2& high)
659 {
660  return b2Max(low, b2Min(a, high));
661 }
662 
663 template<typename T> inline void b2Swap(T& a, T& b)
664 {
665  T tmp = a;
666  a = b;
667  b = tmp;
668 }
669 
676 {
677  x |= (x >> 1);
678  x |= (x >> 2);
679  x |= (x >> 4);
680  x |= (x >> 8);
681  x |= (x >> 16);
682  return x + 1;
683 }
684 
685 inline bool b2IsPowerOfTwo(uint32 x)
686 {
687  bool result = x > 0 && (x & (x - 1)) == 0;
688  return result;
689 }
690 
691 inline void b2Sweep::GetTransform(b2Transform* xf, float32 beta) const
692 {
693  xf->p = (1.0f - beta) * c0 + beta * c;
694  float32 angle = (1.0f - beta) * a0 + beta * a;
695  xf->q.Set(angle);
696 
697  // Shift to origin
698  xf->p -= b2Mul(xf->q, localCenter);
699 }
700 
702 {
703  b2Assert(alpha0 < 1.0f);
704  float32 beta = (alpha - alpha0) / (1.0f - alpha0);
705  c0 += beta * (c - c0);
706  a0 += beta * (a - a0);
707  alpha0 = alpha;
708 }
709 
711 inline void b2Sweep::Normalize()
712 {
713  float32 twoPi = 2.0f * b2_pi;
714  float32 d = twoPi * floorf(a0 / twoPi);
715  a0 -= d;
716  a -= d;
717 }
718 
719 #endif
GLboolean GLboolean GLboolean GLboolean a
d
GLuint GLsizei GLsizei * length
const GLdouble * v
float32 b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
Definition: b2Math.h:405
GLint GLint GLint GLint GLint GLint y
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
Definition: b2Math.h:432
void Advance(float32 alpha)
Definition: b2Math.h:701
b2Vec3 ex
Definition: b2Math.h:294
void SetIdentity()
Set this to the identity matrix.
Definition: b2Math.h:209
b2Vec2 p
Definition: b2Math.h:371
b2Mat33(const b2Vec3 &c1, const b2Vec3 &c2, const b2Vec3 &c3)
Construct this matrix using columns.
Definition: b2Math.h:262
#define b2_pi
Definition: b2Settings.h:40
b2Vec2 c0
Definition: b2Math.h:393
b2Rot q
Definition: b2Math.h:372
GLclampf GLclampf GLclampf alpha
const GLfloat * c
void SetIdentity()
Set to the identity rotation.
Definition: b2Math.h:319
b2Vec2(float32 x, float32 y)
Construct using coordinates.
Definition: b2Math.h:58
void SetZero()
Set this matrix to all zeros.
Definition: b2Math.h:216
void SetIdentity()
Set this to the identity transform.
Definition: b2Math.h:358
void GetTransform(b2Transform *xfb, float32 beta) const
Definition: b2Math.h:691
#define b2_epsilon
Definition: b2Settings.h:39
b2Mat33()
The default constructor does nothing (for performance).
Definition: b2Math.h:259
float32 y
Definition: b2Math.h:178
float32 LengthSquared() const
Definition: b2Math.h:107
#define b2Sqrt(x)
Definition: b2Math.h:48
float32 alpha0
Definition: b2Math.h:398
void operator*=(float32 a)
Multiply this vector by a scalar.
Definition: b2Math.h:94
float32 b2InvSqrt(float32 x)
This is a approximate yet fast inverse square-root.
Definition: b2Math.h:32
void operator-=(const b2Vec2 &v)
Subtract a vector from this vector.
Definition: b2Math.h:88
T b2Max(T a, T b)
Definition: b2Math.h:642
b2Vec2()
Default constructor does nothing (for performance).
Definition: b2Math.h:55
float32 operator()(int32 i) const
Read from and indexed element.
Definition: b2Math.h:70
b2Vec3 ez
Definition: b2Math.h:294
void SetZero()
Set this vector to all zeros.
Definition: b2Math.h:61
A 2D column vector.
Definition: b2Math.h:52
b2Vec2 b2Mul22(const b2Mat33 &A, const b2Vec2 &v)
Multiply a matrix times a vector.
Definition: b2Math.h:533
b2Mat22()
The default constructor does nothing (for performance).
Definition: b2Math.h:185
b2Vec2 ey
Definition: b2Math.h:252
b2Mat22(const b2Vec2 &c1, const b2Vec2 &c2)
Construct this matrix using columns.
Definition: b2Math.h:188
double a0
GLdouble s
signed int int32
Definition: b2Settings.h:31
bool IsValid() const
Does this vector contain finite coordinates?
Definition: b2Math.h:128
b2Vec2 localCenter
local center of mass position
Definition: b2Math.h:392
float32 b2Cross(const b2Vec2 &a, const b2Vec2 &b)
Perform the cross product on two vectors. In 2D this produces a scalar.
Definition: b2Math.h:411
A 2D column vector with 3 elements.
Definition: b2Math.h:143
void SetZero()
Set this vector to all zeros.
Definition: b2Math.h:152
b2Vec3 ey
Definition: b2Math.h:294
b2Vec3()
Default constructor does nothing (for performance).
Definition: b2Math.h:146
float32 b2DistanceSquared(const b2Vec2 &a, const b2Vec2 &b)
Definition: b2Math.h:472
float32 c
Definition: b2Math.h:344
bool b2IsValid(float32 x)
This function is used to ensure that a floating point number is not a NaN or infinity.
Definition: b2Math.h:26
b2Mat22(float32 a11, float32 a12, float32 a21, float32 a22)
Construct this matrix using scalars.
Definition: b2Math.h:195
b2Vec2 operator*(float32 s, const b2Vec2 &a)
Definition: b2Math.h:456
GLint GLint GLint GLint GLint x
float32 x
Definition: b2Math.h:178
unsigned int uint32
Definition: b2Settings.h:34
void b2Swap(T &a, T &b)
Definition: b2Math.h:663
GLfloat GLfloat p
float32 a0
Definition: b2Math.h:394
bool convert(const mrpt_msgs::ObservationRangeBeacon &_msg, const mrpt::poses::CPose3D &_pose, mrpt::obs::CObservationBeaconRanges &_obj)
void operator+=(const b2Vec2 &v)
Add a vector to this vector.
Definition: b2Math.h:82
b2Vec2 operator-() const
Negate this vector.
Definition: b2Math.h:67
bool operator==(const b2Vec2 &a, const b2Vec2 &b)
Definition: b2Math.h:461
b2Vec2 Solve(const b2Vec2 &b) const
Definition: b2Math.h:238
b2Rot()
Definition: b2Math.h:300
b2Vec2 b2MulT(const b2Mat22 &A, const b2Vec2 &v)
Definition: b2Math.h:439
GLdouble GLdouble z
A 3-by-3 matrix. Stored in column-major order.
Definition: b2Math.h:256
b2Vec2 operator+(const b2Vec2 &a, const b2Vec2 &b)
Add two vectors component-wise.
Definition: b2Math.h:445
float32 y
Definition: b2Math.h:139
uint32 b2NextPowerOfTwo(uint32 x)
Definition: b2Math.h:675
b2Vec3(float32 x, float32 y, float32 z)
Construct using coordinates.
Definition: b2Math.h:149
const b2Vec2 b2Vec2_zero
Useful constant.
float32 GetAngle() const
Get the angle in radians.
Definition: b2Math.h:326
void Normalize()
Normalize the angles.
Definition: b2Math.h:711
void Set(const b2Vec2 &position, float32 angle)
Set this based on the position and angle.
Definition: b2Math.h:365
#define b2Assert(A)
Definition: b2Settings.h:27
void SetZero()
Set this matrix to all zeros.
Definition: b2Math.h:270
bool b2IsPowerOfTwo(uint32 x)
Definition: b2Math.h:685
b2Vec2 GetYAxis() const
Get the u-axis.
Definition: b2Math.h:338
void Set(float32 angle)
Set using an angle in radians.
Definition: b2Math.h:311
T b2Clamp(T a, T low, T high)
Definition: b2Math.h:653
b2Transform(const b2Vec2 &position, const b2Rot &rotation)
Initialize using a position vector and a rotation.
Definition: b2Math.h:355
GLdouble GLdouble GLdouble r
b2Vec2 Skew() const
Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
Definition: b2Math.h:134
b2Vec2 ex
Definition: b2Math.h:252
T b2Abs(T a)
Definition: b2Math.h:615
A 2-by-2 matrix. Stored in column-major order.
Definition: b2Math.h:182
b2Vec2 GetXAxis() const
Get the x-axis.
Definition: b2Math.h:332
GLdouble angle
Rotation.
Definition: b2Math.h:298
void Set(float32 x_, float32 y_, float32 z_)
Set this vector to some specified coordinates.
Definition: b2Math.h:155
void Set(const b2Vec2 &c1, const b2Vec2 &c2)
Initialize this matrix using columns.
Definition: b2Math.h:202
T b2Min(T a, T b)
Definition: b2Math.h:631
GLdouble GLdouble GLdouble b
float32 z
Definition: b2Math.h:178
float32 s
Sine and cosine.
Definition: b2Math.h:344
#define b2Atan2(y, x)
Definition: b2Math.h:49
GLdouble GLdouble GLdouble GLdouble q
float32 x
Definition: b2Math.h:139
b2Transform()
The default constructor does nothing.
Definition: b2Math.h:352
float32 Normalize()
Convert this vector into a unit vector. Returns the length.
Definition: b2Math.h:113
EIGEN_STRONG_INLINE Scalar det() const
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition: b2Math.h:64
b2Rot(float32 angle)
Initialize from an angle in radians.
Definition: b2Math.h:303
float32 b2Distance(const b2Vec2 &a, const b2Vec2 &b)
Definition: b2Math.h:466
b2Mat22 GetInverse() const
Definition: b2Math.h:222
float32 Length() const
Get the length of this vector (the norm).
Definition: b2Math.h:100
float float32
Definition: b2Settings.h:35
CArrayDouble< 6 > C
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51