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

Method ComputeAABB

CollisionB2ShapePolygon.go:335–349  ·  view source on GitHub ↗
(aabb *B2AABB, xf B2Transform, childIndex int)

Source from the content-addressed store, hash-verified

333}
334
335func (poly B2PolygonShape) ComputeAABB(aabb *B2AABB, xf B2Transform, childIndex int) {
336
337 lower := B2TransformVec2Mul(xf, poly.M_vertices[0])
338 upper := lower
339
340 for i := 1; i < poly.M_count; i++ {
341 v := B2TransformVec2Mul(xf, poly.M_vertices[i])
342 lower = B2Vec2Min(lower, v)
343 upper = B2Vec2Max(upper, v)
344 }
345
346 r := MakeB2Vec2(poly.M_radius, poly.M_radius)
347 aabb.LowerBound = B2Vec2Sub(lower, r)
348 aabb.UpperBound = B2Vec2Sub(upper, r)
349}
350
351func (poly B2PolygonShape) ComputeMass(massData *B2MassData, density float64) {
352 // Polygon mass, centroid, and inertia.

Callers

nothing calls this directly

Calls 5

B2TransformVec2MulFunction · 0.85
B2Vec2MinFunction · 0.85
B2Vec2MaxFunction · 0.85
MakeB2Vec2Function · 0.85
B2Vec2SubFunction · 0.85

Tested by

no test coverage detected