Skip to content

Commit

Permalink
delete old comments; better name for function
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Dec 27, 2012
1 parent 9f07f2a commit 9438291
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions sml-lib/bdd/dynamic-tree.sml
Expand Up @@ -289,11 +289,11 @@ struct
else A_interior
end

(* Climb the tree starting at the given node, expanding the derived
AABBs if necessary.
(* Climb the tree starting at the given node, balancing and keeping
the AABBS and heights up to date.
Port note: In the original, usually inlined as a do..while loop.
*)
fun adjust_aabbs (tree : 'a dynamic_tree,
fun climb_and_adjust (tree : 'a dynamic_tree,
nd as Nd _) =
let
val nd' = balance (tree, nd)
Expand All @@ -302,7 +302,7 @@ struct

case get_parent (Node nd') of
NoParent => ()
| Parent (ptn, _) => adjust_aabbs (tree, ptn)
| Parent (ptn, _) => climb_and_adjust (tree, ptn)
end

fun aabb_perimeter {upperbound, lowerbound} =
Expand Down Expand Up @@ -386,10 +386,7 @@ struct
Left => left := Node new
| Right => right := Node new );

(* Port note: This expansion routine is not exactly
the same as the one in the code, but I believe
it has equivalent effect. *)
adjust_aabbs (tree, nd)
climb_and_adjust (tree, nd)
end;

checktreestructure "insert_leaf after" tree
Expand All @@ -399,9 +396,7 @@ struct
proxy as Lf {parent, ...}) =
let
in
(* If it's the root, we just make the tree empty.
Port note: Throughout this code, Box2D uses equality
on proxy IDs (integers); I use ref equality. *)
(* If it's the root, we just make the tree empty. *)
(case !parent of
NoParent => set_root (tree, NONE)
| Parent (Nd { left, right, parent = grandparent, ... }, dir) =>
Expand All @@ -426,7 +421,7 @@ struct

set_parent (sibling, Parent (gpn, dir));
(* Adjust ancestor bounds. *)
adjust_aabbs (tree, gpn)
climb_and_adjust (tree, gpn)
end
end);
checktreestructure "remove_leaf after" tree
Expand Down

0 comments on commit 9438291

Please sign in to comment.