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

Method SetAsBox

CollisionB2ShapePolygon.go:60–71  ·  view source on GitHub ↗
(hx float64, hy float64)

Source from the content-addressed store, hash-verified

58func (edge *B2PolygonShape) Destroy() {}
59
60func (poly *B2PolygonShape) SetAsBox(hx float64, hy float64) {
61 poly.M_count = 4
62 poly.M_vertices[0].Set(-hx, -hy)
63 poly.M_vertices[1].Set(hx, -hy)
64 poly.M_vertices[2].Set(hx, hy)
65 poly.M_vertices[3].Set(-hx, hy)
66 poly.M_normals[0].Set(0.0, -1.0)
67 poly.M_normals[1].Set(1.0, 0.0)
68 poly.M_normals[2].Set(0.0, 1.0)
69 poly.M_normals[3].Set(-1.0, 0.0)
70 poly.M_centroid.SetZero()
71}
72
73func (poly *B2PolygonShape) SetAsBoxFromCenterAndAngle(hx float64, hy float64, center B2Vec2, angle float64) {
74 poly.M_count = 4

Callers 2

SetMethod · 0.95
TestCPPComplianceFunction · 0.80

Calls 2

SetMethod · 0.45
SetZeroMethod · 0.45

Tested by 1

TestCPPComplianceFunction · 0.64