ALGO: avoid printing KTNil for both childs
This commit is contained in:
parent
968262d935
commit
78a3dd8b95
@ -125,14 +125,16 @@ rangeSearch kd' sq' = (goPt kd' sq', goTree kd' sq' True)
|
|||||||
-- A pretty rose tree suitable for printing.
|
-- A pretty rose tree suitable for printing.
|
||||||
goTree :: KDTree PT -> Square -> Bool -> Tree String
|
goTree :: KDTree PT -> Square -> Bool -> Tree String
|
||||||
goTree KTNil _ _ = Node "nil" []
|
goTree KTNil _ _ = Node "nil" []
|
||||||
goTree (KTNode ln pt dir rn) sq vis =
|
goTree (KTNode ln pt dir rn) sq vis
|
||||||
Node treeText
|
| ln == KTNil && rn == KTNil = Node treeText []
|
||||||
[if' (p1' dir sq < (cur' dir . unp2 $ pt))
|
| otherwise =
|
||||||
(goTree ln sq vis)
|
Node treeText
|
||||||
(goTree ln sq False)
|
[if' (p1' dir sq < (cur' dir . unp2 $ pt))
|
||||||
, if' ((cur' dir . unp2 $ pt) < p2' dir sq)
|
(goTree ln sq vis)
|
||||||
(goTree rn sq vis)
|
(goTree ln sq False)
|
||||||
(goTree rn sq False)]
|
, if' ((cur' dir . unp2 $ pt) < p2' dir sq)
|
||||||
|
(goTree rn sq vis)
|
||||||
|
(goTree rn sq False)]
|
||||||
where
|
where
|
||||||
treeText
|
treeText
|
||||||
| vis && inRange sq pt = "** " ++ (show . unp2 $ pt)
|
| vis && inRange sq pt = "** " ++ (show . unp2 $ pt)
|
||||||
|
Loading…
Reference in New Issue
Block a user