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

Method ComputeEdgeSeparation

CollisionB2CollideEdge.go:541–559  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

539}
540
541func (collider *B2EPCollider) ComputeEdgeSeparation() B2EPAxis {
542 axis := MakeB2EPAxis()
543 axis.Type = B2EPAxis_Type.E_edgeA
544 if collider.M_front {
545 axis.Index = 0
546 } else {
547 axis.Index = 1
548 }
549 axis.Separation = B2_maxFloat
550
551 for i := 0; i < collider.M_polygonB.Count; i++ {
552 s := B2Vec2Dot(collider.M_normal, B2Vec2Sub(collider.M_polygonB.Vertices[i], collider.M_v1))
553 if s < axis.Separation {
554 axis.Separation = s
555 }
556 }
557
558 return axis
559}
560
561func (collider *B2EPCollider) ComputePolygonSeparation() B2EPAxis {
562

Callers 1

CollideMethod · 0.95

Calls 3

MakeB2EPAxisFunction · 0.85
B2Vec2DotFunction · 0.85
B2Vec2SubFunction · 0.85

Tested by

no test coverage detected