add function to quad tree to turn items into strings (for later saving to file)
This commit is contained in:
@@ -500,4 +500,39 @@ struct
|
||||
in
|
||||
Vector.concat vec
|
||||
end
|
||||
|
||||
fun toStringFolder ({x, ex, y, ey, data = {r, g, b, a}}, acc) =
|
||||
let
|
||||
val item = String.concat
|
||||
[ "{"
|
||||
, Int.toString x
|
||||
, " "
|
||||
, Int.toString y
|
||||
, " "
|
||||
, Int.toString ex
|
||||
, " "
|
||||
, Int.toString ey
|
||||
, " "
|
||||
, Int.toString r
|
||||
, " "
|
||||
, Int.toString g
|
||||
, " "
|
||||
, Int.toString b
|
||||
, " "
|
||||
, Int.toString a
|
||||
, " }"
|
||||
]
|
||||
in
|
||||
item :: acc
|
||||
end
|
||||
|
||||
fun toString (squares, size) =
|
||||
let
|
||||
val qtree = buildTree (0, 0, size, squares)
|
||||
val bintree = merge (qtree, squares)
|
||||
|
||||
val vec = BinTree.foldr (toStringFolder, bintree, [])
|
||||
in
|
||||
Vector.concat vec
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user