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

Method Query

CollisionB2DynamicTree.go:75–99  ·  view source on GitHub ↗
(queryCallback B2TreeQueryCallback, aabb B2AABB)

Source from the content-addressed store, hash-verified

73}
74
75func (tree *B2DynamicTree) Query(queryCallback B2TreeQueryCallback, aabb B2AABB) {
76 stack := NewB2GrowableStack()
77 stack.Push(tree.M_root)
78
79 for stack.GetCount() > 0 {
80 nodeId := stack.Pop().(int)
81 if nodeId == B2_nullNode {
82 continue
83 }
84
85 node := &tree.M_nodes[nodeId]
86
87 if B2TestOverlapBoundingBoxes(node.Aabb, aabb) {
88 if node.IsLeaf() {
89 proceed := queryCallback(nodeId)
90 if proceed == false {
91 return
92 }
93 } else {
94 stack.Push(node.Child1)
95 stack.Push(node.Child2)
96 }
97 }
98 }
99}
100
101func (tree B2DynamicTree) RayCast(rayCastCallback B2TreeRayCastCallback, input B2RayCastInput) {
102

Callers

nothing calls this directly

Calls 6

PushMethod · 0.95
GetCountMethod · 0.95
PopMethod · 0.95
NewB2GrowableStackFunction · 0.85
IsLeafMethod · 0.80

Tested by

no test coverage detected