MCPcopy Create free account
hub / github.com/aevum/libgdx-cpp / Solve2

Method Solve2

src/Box2D/Collision/b2Distance.cpp:298–330  ·  view source on GitHub ↗

Solve a line segment using barycentric coordinates. p = a1 * w1 + a2 * w2 a1 + a2 = 1 The vector from the origin to the closest point on the line is perpendicular to the line. e12 = w2 - w1 dot(p, e) = 0 a1 * dot(w1, e) + a2 * dot(w2, e) = 0 2-by-2 linear system [1 1 ][a1] = [1] [w1.e12 w2.e12][a2] = [0] Define d12_1 = dot(w2, e12) d12_2 = -dot(w1, e12) d12 = d12_1 + d12_2 Solution

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

b2DistanceFunction · 0.80

Calls 1

b2DotFunction · 0.85

Tested by

no test coverage detected