a bit of refactoring for quad tree's 'toTriangles' function
This commit is contained in:
@@ -236,13 +236,12 @@ struct
|
||||
BinTree.insert (item, acc)
|
||||
|
||||
fun toList qtree =
|
||||
let
|
||||
val tree = foldWithDuplicates (insertItemIntoTree, qtree, BinTree.empty)
|
||||
in
|
||||
BinTree.toList (tree, [])
|
||||
let val tree = foldWithDuplicates (insertItemIntoTree, qtree, BinTree.empty)
|
||||
in BinTree.toList (tree, [])
|
||||
end
|
||||
|
||||
fun toTriangles (windowWidth, windowHeight, squares, acc) =
|
||||
local
|
||||
fun loop (windowWidth, windowHeight, squares, acc) =
|
||||
case squares of
|
||||
{x, y, ex, ey, data = _} :: tl =>
|
||||
let
|
||||
@@ -253,7 +252,11 @@ struct
|
||||
|
||||
val acc = Ndc.ltrbToVertex (startX, startY, endX, endY) :: acc
|
||||
in
|
||||
toTriangles (windowWidth, windowHeight, tl, acc)
|
||||
loop (windowWidth, windowHeight, tl, acc)
|
||||
end
|
||||
| [] => Vector.concat acc
|
||||
in
|
||||
fun toTriangles (windowWidth, windowHeight, squares) =
|
||||
loop (windowWidth, windowHeight, squares, [])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user