29 return (ix & 0x7f800000) != 0x7f800000;
45 x = x * (1.5f - xhalf * x * x);
49 #define b2Sqrt(x) sqrtf(x) 50 #define b2Atan2(y, x) atan2f(y, x) 110 return x *
x +
y *
y;
121 float32 invLength = 1.0f / length;
164 x += v.
x;
y += v.
y;
z += v.
z;
170 x -= v.
x;
y -= v.
y;
z -= v.
z;
176 x *= s;
y *= s;
z *= s;
198 ex.x = a11; ex.y = a21;
199 ey.x = a12; ey.y = a22;
212 ex.x = 1.0f; ey.x = 0.0f;
213 ex.y = 0.0f; ey.y = 1.0f;
219 ex.x = 0.0f; ey.x = 0.0f;
220 ex.y = 0.0f; ey.y = 0.0f;
225 float32 a = ex.x, b = ey.x, c = ex.y,
d = ey.y;
232 B.
ex.
x = det *
d; B.
ey.
x = -det * b;
233 B.
ex.
y = -det * c; B.
ey.
y = det * a;
241 float32 a11 = ex.
x, a12 = ey.x, a21 = ex.y, a22 = ey.y;
242 float32 det = a11 * a22 - a12 * a21;
248 x.
x = det * (a22 * b.
x - a12 * b.
y);
249 x.
y = det * (a11 * b.
y - a21 * b.
x);
289 void GetInverse22(
b2Mat33* M)
const;
293 void GetSymInverse33(
b2Mat33* M)
const;
408 return a.
x * b.
x + a.
y * b.
y;
414 return a.
x * b.
y - a.
y * b.
x;
464 return a.
x == b.
x && a.
y == b.
y;
481 return b2Vec3(s * a.
x, s * a.
y, s * a.
z);
499 return a.
x * b.
x + a.
y * b.
y + a.
z * b.
z;
530 return v.
x * A.
ex + v.
y * A.
ey + v.
z * A.
ez;
547 qr.
s = q.
s * r.
c + q.
c * r.
s;
548 qr.
c = q.
c * r.
c - q.
s * r.
s;
560 qr.
s = q.
c * r.
s - q.
s * r.
c;
561 qr.
c = q.
c * r.
c + q.
s * r.
s;
615 template <
typename T>
618 return a > T(0) ? a : -a;
631 template <
typename T>
634 return a < b ? a : b;
642 template <
typename T>
645 return a > b ? a : b;
653 template <
typename T>
664 template<
typename T>
inline void b2Swap(T& a, T& b)
688 bool result = x > 0 && (x & (x - 1)) == 0;
694 xf->
p = (1.0f - beta) * c0 + beta * c;
699 xf->
p -=
b2Mul(xf->
q, localCenter);
705 float32 beta = (alpha - alpha0) / (1.0
f - alpha0);
706 c0 += beta * (c - c0);
707 a0 += beta * (a - a0);
715 float32 d = twoPi * floorf(a0 / twoPi);
float32 b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
void Advance(float32 alpha)
void SetIdentity()
Set this to the identity matrix.
b2Mat33(const b2Vec3 &c1, const b2Vec3 &c2, const b2Vec3 &c3)
Construct this matrix using columns.
void SetIdentity()
Set to the identity rotation.
b2Vec2(float32 x, float32 y)
Construct using coordinates.
void SetZero()
Set this matrix to all zeros.
void GetTransform(b2Transform *xfb, float32 beta) const
b2Mat33()
The default constructor does nothing (for performance).
float32 LengthSquared() const
void operator*=(float32 a)
Multiply this vector by a scalar.
float32 b2InvSqrt(float32 x)
This is a approximate yet fast inverse square-root.
void operator-=(const b2Vec2 &v)
Subtract a vector from this vector.
b2Vec2()
Default constructor does nothing (for performance).
float32 operator()(int32 i) const
Read from and indexed element.
void SetZero()
Set this vector to all zeros.
b2Vec2 b2Mul22(const b2Mat33 &A, const b2Vec2 &v)
Multiply a matrix times a vector.
b2Mat22()
The default constructor does nothing (for performance).
b2Mat22(const b2Vec2 &c1, const b2Vec2 &c2)
Construct this matrix using columns.
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
bool IsValid() const
Does this vector contain finite coordinates?
b2Vec2 localCenter
local center of mass position
float32 b2Cross(const b2Vec2 &a, const b2Vec2 &b)
Perform the cross product on two vectors. In 2D this produces a scalar.
A 2D column vector with 3 elements.
void SetZero()
Set this vector to all zeros.
b2Vec3()
Default constructor does nothing (for performance).
float32 b2DistanceSquared(const b2Vec2 &a, const b2Vec2 &b)
bool b2IsValid(float32 x)
This function is used to ensure that a floating point number is not a NaN or infinity.
b2Mat22(float32 a11, float32 a12, float32 a21, float32 a22)
Construct this matrix using scalars.
b2Vec2 operator*(float32 s, const b2Vec2 &a)
void operator+=(const b2Vec2 &v)
Add a vector to this vector.
b2Vec2 operator-() const
Negate this vector.
bool operator==(const b2Vec2 &a, const b2Vec2 &b)
b2Vec2 Solve(const b2Vec2 &b) const
b2Vec2 b2MulT(const b2Mat22 &A, const b2Vec2 &v)
TFSIMD_FORCE_INLINE const tfScalar & z() const
A 3-by-3 matrix. Stored in column-major order.
b2Vec2 operator+(const b2Vec2 &a, const b2Vec2 &b)
Add two vectors component-wise.
uint32 b2NextPowerOfTwo(uint32 x)
b2Vec3(float32 x, float32 y, float32 z)
Construct using coordinates.
const b2Vec2 b2Vec2_zero
Useful constant.
float32 GetAngle() const
Get the angle in radians.
void Normalize()
Normalize the angles.
void SetZero()
Set this matrix to all zeros.
bool b2IsPowerOfTwo(uint32 x)
b2Vec2 GetYAxis() const
Get the u-axis.
void Set(float32 angle)
Set using an angle in radians.
T b2Clamp(T a, T low, T high)
b2Vec2 Skew() const
Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
A 2-by-2 matrix. Stored in column-major order.
b2Vec2 GetXAxis() const
Get the x-axis.
void convert(const A &a, B &b)
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
void Set(float32 x_, float32 y_, float32 z_)
Set this vector to some specified coordinates.
void Set(const b2Vec2 &c1, const b2Vec2 &c2)
Initialize this matrix using columns.
float32 s
Sine and cosine.
float32 Normalize()
Convert this vector into a unit vector. Returns the length.
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
b2Rot(float32 angle)
Initialize from an angle in radians.
float32 b2Distance(const b2Vec2 &a, const b2Vec2 &b)
b2Mat22 GetInverse() const
float32 Length() const
Get the length of this vector (the norm).