93 float s =
b2Dot(pointA - pointB, normal);
118 float s =
b2Dot(pointB - pointA, normal);
168 float separation =
b2Dot(pointB - pointA, normal);
185 float separation =
b2Dot(pointA - pointB, normal);
226 float separation =
b2Dot(pointB - pointA, normal);
238 float separation =
b2Dot(pointA - pointB, normal);
265 output->
t = input->
tMax;
278 float tMax = input->
tMax;
286 const int32 k_maxIterations = 20;
310 b2Distance(&distanceOutput, &cache, &distanceInput);
313 if (distanceOutput.
distance <= 0.0f)
321 if (distanceOutput.
distance < target + tolerance)
331 fcn.
Initialize(&cache, proxyA, sweepA, proxyB, sweepB, t1);
342 for (
int32 i = 0; i <= N; ++i)
346 float f = fcn.
Evaluate(xfA, xfB) - target;
348 printf(
"%g %g\n", x, f);
362 int32 pushBackIter = 0;
366 int32 indexA, indexB;
370 if (s2 > target + tolerance)
380 if (s2 > target - tolerance)
388 float s1 = fcn.
Evaluate(indexA, indexB, t1);
392 if (s1 < target - tolerance)
401 if (s1 <= target + tolerance)
411 int32 rootIterCount = 0;
412 float a1 = t1, a2 = t2;
417 if (rootIterCount & 1)
420 t = a1 + (target - s1) * (a2 - a1) / (s2 - s1);
425 t = 0.5f * (a1 + a2);
431 float s = fcn.
Evaluate(indexA, indexB, t);
433 if (
b2Abs(s - target) < tolerance)
452 if (rootIterCount == 50)
476 if (iter == k_maxIterations)
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
float b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
const b2DistanceProxy * m_proxyA
uint8 indexA[3]
vertices on shape A
float Evaluate(int32 indexA, int32 indexB, float t) const
geometry_msgs::TransformStamped t
B2_API int32 b2_toiMaxRootIters
int32 GetSupport(const b2Vec2 &d) const
Get the supporting vertex index in the given direction.
float b2Cross(const b2Vec2 &a, const b2Vec2 &b)
Perform the cross product on two vectors. In 2D this produces a scalar.
B2_API void b2Distance(b2DistanceOutput *output, b2SimplexCache *cache, const b2DistanceInput *input)
uint8 indexB[3]
vertices on shape B
B2_API int32 b2_toiRootIters
float FindMinSeparation(int32 *indexA, int32 *indexB, float t) const
const b2DistanceProxy * m_proxyB
void Normalize()
Normalize the angles.
Output parameters for b2TimeOfImpact.
b2Vec2 b2MulT(const b2Mat22 &A, const b2Vec2 &v)
float Initialize(const b2SimplexCache *cache, const b2DistanceProxy *proxyA, const b2Sweep &sweepA, const b2DistanceProxy *proxyB, const b2Sweep &sweepB, float t1)
float Normalize()
Convert this vector into a unit vector. Returns the length.
#define b2_maxPolygonVertices
B2_API float b2_toiMaxTime
void b2TimeOfImpact(b2TOIOutput *output, const b2TOIInput *input)
void GetTransform(b2Transform *transform, float beta) const
const b2Vec2 & GetVertex(int32 index) const
Get a vertex by index. Used by b2Distance.
B2_API int32 b2_toiMaxIters
float GetMilliseconds() const
Get the time since construction or the last reset.