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

Method ValidateMetrics

CollisionB2DynamicTree.go:701–734  ·  view source on GitHub ↗
(index int)

Source from the content-addressed store, hash-verified

699}
700
701func (tree B2DynamicTree) ValidateMetrics(index int) {
702 if index == B2_nullNode {
703 return
704 }
705
706 node := &tree.M_nodes[index]
707
708 child1 := node.Child1
709 child2 := node.Child2
710
711 if node.IsLeaf() {
712 B2Assert(child1 == B2_nullNode)
713 B2Assert(child2 == B2_nullNode)
714 B2Assert(node.Height == 0)
715 return
716 }
717
718 B2Assert(0 <= child1 && child1 < tree.M_nodeCapacity)
719 B2Assert(0 <= child2 && child2 < tree.M_nodeCapacity)
720
721 height1 := tree.M_nodes[child1].Height
722 height2 := tree.M_nodes[child2].Height
723 height := 1 + MaxInt(height1, height2)
724 B2Assert(node.Height == height)
725
726 aabb := NewB2AABB()
727 aabb.CombineTwoInPlace(tree.M_nodes[child1].Aabb, tree.M_nodes[child2].Aabb)
728
729 B2Assert(aabb.LowerBound == node.Aabb.LowerBound)
730 B2Assert(aabb.UpperBound == node.Aabb.UpperBound)
731
732 tree.ValidateMetrics(child1)
733 tree.ValidateMetrics(child2)
734}
735
736func (tree B2DynamicTree) Validate() {
737}

Callers

nothing calls this directly

Calls 5

CombineTwoInPlaceMethod · 0.95
B2AssertFunction · 0.85
MaxIntFunction · 0.85
NewB2AABBFunction · 0.85
IsLeafMethod · 0.80

Tested by

no test coverage detected