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

Method TestPoint

CollisionB2ShapePolygon.go:262–273  ·  view source on GitHub ↗
(xf B2Transform, p B2Vec2)

Source from the content-addressed store, hash-verified

260}
261
262func (poly B2PolygonShape) TestPoint(xf B2Transform, p B2Vec2) bool {
263 pLocal := B2RotVec2MulT(xf.Q, B2Vec2Sub(p, xf.P))
264
265 for i := 0; i < poly.M_count; i++ {
266 dot := B2Vec2Dot(poly.M_normals[i], B2Vec2Sub(pLocal, poly.M_vertices[i]))
267 if dot > 0.0 {
268 return false
269 }
270 }
271
272 return true
273}
274
275func (poly B2PolygonShape) RayCast(output *B2RayCastOutput, input B2RayCastInput, xf B2Transform, childIndex int) bool {
276

Callers

nothing calls this directly

Calls 3

B2RotVec2MulTFunction · 0.85
B2Vec2SubFunction · 0.85
B2Vec2DotFunction · 0.85

Tested by

no test coverage detected