MCPcopy Create free account
hub / github.com/ByteArena/box2d / GetClosestPoint

Method GetClosestPoint

CollisionB2Distance.go:331–359  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

329}
330
331func (simplex B2Simplex) GetClosestPoint() B2Vec2 {
332 switch simplex.M_count {
333 case 0:
334 B2Assert(false)
335 return B2Vec2_zero
336
337 case 1:
338 return simplex.M_vs[0].W
339
340 case 2:
341 return B2Vec2Add(
342 B2Vec2MulScalar(
343 simplex.M_vs[0].A,
344 simplex.M_vs[0].W,
345 ),
346 B2Vec2MulScalar(
347 simplex.M_vs[1].A,
348 simplex.M_vs[1].W,
349 ),
350 )
351
352 case 3:
353 return B2Vec2_zero
354
355 default:
356 B2Assert(false)
357 return B2Vec2_zero
358 }
359}
360
361func (simplex B2Simplex) GetWitnessPoints(pA *B2Vec2, pB *B2Vec2) {
362 switch simplex.M_count {

Callers

nothing calls this directly

Calls 3

B2AssertFunction · 0.85
B2Vec2AddFunction · 0.85
B2Vec2MulScalarFunction · 0.85

Tested by

no test coverage detected