fix bug in not properly updating squares vector
This commit is contained in:
@@ -226,14 +226,9 @@ struct
|
||||
end
|
||||
|
||||
fun insertItemIntoTree (item, acc) =
|
||||
if #data item = 0 then
|
||||
(* ignore specific data by not inserting it into tree.
|
||||
* May later functorise this quad tree,
|
||||
* and allow different types of data
|
||||
* to be ignored/stored in #data field. *)
|
||||
acc
|
||||
else
|
||||
if #data item <> 0 then
|
||||
BinTree.insert (item, acc)
|
||||
else acc
|
||||
|
||||
fun toList qtree =
|
||||
let val tree = foldWithDuplicates (insertItemIntoTree, qtree, BinTree.empty)
|
||||
@@ -255,7 +250,9 @@ struct
|
||||
val startY = Ndc.fromPixelY (y, windowWidth, windowHeight)
|
||||
val endY = Ndc.fromPixelY (ey, windowWidth, windowHeight)
|
||||
|
||||
val acc = Ndc.ltrbToVertex (startX, startY, endX, endY) :: acc
|
||||
val vec =
|
||||
Ndc.ltrbToVertexRgb (startX, startY, endX, endY, 0.0, 0.0, 0.0)
|
||||
val acc = vec :: acc
|
||||
in
|
||||
loop (windowWidth, windowHeight, tl, acc)
|
||||
end
|
||||
@@ -265,6 +262,8 @@ struct
|
||||
let
|
||||
val qtree = build (0, 0, size, squares)
|
||||
val squares = toList qtree
|
||||
val msg = List.length squares
|
||||
val () = print (Int.toString msg ^ "\n")
|
||||
in
|
||||
loop (windowWidth, windowHeight, squares, [])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user