MCPcopy Create free account
hub / github.com/cinder/Cinder / Solve22

Method Solve22

blocks/Box2D/src/Box2D/Common/b2Math.cpp:41–53  ·  view source on GitHub ↗

Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases.

Source from the content-addressed store, hash-verified

39/// Solve A * x = b, where b is a column vector. This is more efficient
40/// than computing the inverse in one-shot cases.
41b2Vec2 b2Mat33::Solve22(const b2Vec2& b) const
42{
43 float32 a11 = ex.x, a12 = ey.x, a21 = ex.y, a22 = ey.y;
44 float32 det = a11 * a22 - a12 * a21;
45 if (det != 0.0f)
46 {
47 det = 1.0f / det;
48 }
49 b2Vec2 x;
50 x.x = det * (a22 * b.x - a12 * b.y);
51 x.y = det * (a11 * b.y - a21 * b.x);
52 return x;
53}
54
55///
56void b2Mat33::GetInverse22(b2Mat33* M) const

Callers 3

Calls

no outgoing calls

Tested by

no test coverage detected