(index int)
| 699 | } |
| 700 | |
| 701 | func (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 | |
| 736 | func (tree B2DynamicTree) Validate() { |
| 737 | } |
nothing calls this directly
no test coverage detected