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

Method ValidateStructure

CollisionB2DynamicTree.go:670–699  ·  view source on GitHub ↗
(index int)

Source from the content-addressed store, hash-verified

668}
669
670func (tree B2DynamicTree) ValidateStructure(index int) {
671 if index == B2_nullNode {
672 return
673 }
674
675 if index == tree.M_root {
676 B2Assert(tree.M_nodes[index].Parent == B2_nullNode)
677 }
678
679 node := &tree.M_nodes[index]
680
681 child1 := node.Child1
682 child2 := node.Child2
683
684 if node.IsLeaf() {
685 B2Assert(child1 == B2_nullNode)
686 B2Assert(child2 == B2_nullNode)
687 B2Assert(node.Height == 0)
688 return
689 }
690
691 B2Assert(0 <= child1 && child1 < tree.M_nodeCapacity)
692 B2Assert(0 <= child2 && child2 < tree.M_nodeCapacity)
693
694 B2Assert(tree.M_nodes[child1].Parent == index)
695 B2Assert(tree.M_nodes[child2].Parent == index)
696
697 tree.ValidateStructure(child1)
698 tree.ValidateStructure(child2)
699}
700
701func (tree B2DynamicTree) ValidateMetrics(index int) {
702 if index == B2_nullNode {

Callers

nothing calls this directly

Calls 2

B2AssertFunction · 0.85
IsLeafMethod · 0.80

Tested by

no test coverage detected