diff --git a/dotscape b/dotscape index 9ba9e24..0da08b5 100755 Binary files a/dotscape and b/dotscape differ diff --git a/fcore/quad-tree.sml b/fcore/quad-tree.sml index 3d7c5c9..f354b5d 100644 --- a/fcore/quad-tree.sml +++ b/fcore/quad-tree.sml @@ -632,15 +632,43 @@ struct fun toCollisionStringFolder ({x, ex, y, ey, data = _}, acc) = let - val ex = if x = ex then ex + 1 else ex + val ex = ex + 1 val ey = if y = ey then ey + 1 else ey + val width = ex - x + val width = if width = 0 then width + 1 else width + val height = ey - y + val height = if height = 0 then height + 1 else height + + val x = Int.toString x + val y = Int.toString y + val width = Int.toString width + val height = Int.toString height + + val item = String.concat + [ "{x = " + , x + , ", y = " + , y + , ", width = " + , width + , ", height = " + , height + , " }" + ] + in + item :: acc + end + fun toCollisionString (squares, canvasWidth, canvasHeight) = let val size = Int.max (canvasWidth, canvasHeight) val qtree = buildTree (0, 0, size, squares) val bintree = merge (qtree, squares) - val collisions = BinTree.foldr (toExportStringFolder, bintree, []) - val collisions = String.concatWith ",\n" coords + val collisions = BinTree.foldr (toCollisionStringFolder, bintree, []) + val collisions = String.concatWith ",\n" collisions + in + String.concat ["val collisions = #[", collisions, "]\n"] + end end diff --git a/green.dsc b/green.dsc deleted file mode 100644 index dd7d862..0000000 --- a/green.dsc +++ /dev/null @@ -1 +0,0 @@ -10 10 { {0 0 0 10 0 0 0 1 } {0 0 9 0 0 0 0 1 } {0 9 9 10 0 0 0 1 } {2 2 7 2 0 0 0 1 } {9 0 9 10 0 0 0 1 } } \ No newline at end of file diff --git a/green.sml b/green.sml deleted file mode 100644 index 2e7bdb1..0000000 --- a/green.sml +++ /dev/null @@ -1,85 +0,0 @@ -structure AAA = -struct - fun xToNdc (xOffset, xpos, scale, halfWidth) = - ((xpos * scale + xOffset) - halfWidth) / halfWidth - - fun endXToNdc (xOffset, startX, endX, scale, halfWidth) = - (((endX - startX) * scale + xOffset) - halfWidth) / halfWidth - - fun yToNdc (yOffset, ypos, scale, halfHeight) = - ~(((ypos * scale + yOffset) - halfHeight) / halfHeight) - - fun endYToNdc (yOffset, startY, endY, scale, halfHeight) = - ~((((endY - startY) * scale + yOffset) - halfHeight) / halfHeight) - - fun lerp (xOffset, yOffset, scale, windowWidth, windowHeight) = - let - val windowWidth = Real32.fromInt windowWidth - val halfWidth = windowWidth / 2.0 - val windowHeight = Real32.fromInt windowHeight - val halfHeight = windowHeight / 2.0 - in - #[ -xToNdc (xOffset, 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 10.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 10.000000000000000, scale, halfHeight), -xToNdc (xOffset, 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 0.000000000000000, scale, halfHeight), -xToNdc (xOffset, 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 0.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 10.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 0.000000000000000, scale, halfHeight), -xToNdc (xOffset, 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 1.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 1.000000000000000, scale, halfHeight), -xToNdc (xOffset, 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 0.000000000000000, scale, halfHeight), -xToNdc (xOffset, 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 0.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 1.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 0.000000000000000, scale, halfHeight), -xToNdc (xOffset, 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 10.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 10.000000000000000, scale, halfHeight), -xToNdc (xOffset, 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 9.000000000000000, scale, halfHeight), -xToNdc (xOffset, 0.000000000000000, scale, halfWidth), -yToNdc (yOffset, 9.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 10.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 9.000000000000000, scale, halfHeight), -xToNdc (xOffset, 2.000000000000000, scale, halfWidth), -yToNdc (yOffset, 3.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 2.000000000000000, scale, halfWidth), 7.000000000000000, scale, halfWidth), -yToNdc (yOffset, 3.000000000000000, scale, halfHeight), -xToNdc (xOffset, 2.000000000000000, scale, halfWidth), -yToNdc (yOffset, 2.000000000000000, scale, halfHeight), -xToNdc (xOffset, 2.000000000000000, scale, halfWidth), -yToNdc (yOffset, 2.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 2.000000000000000, scale, halfWidth), 7.000000000000000, scale, halfWidth), -yToNdc (yOffset, 3.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 2.000000000000000, scale, halfWidth), 7.000000000000000, scale, halfWidth), -yToNdc (yOffset, 2.000000000000000, scale, halfHeight), -xToNdc (xOffset, 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 10.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 9.000000000000000, scale, halfWidth), 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 10.000000000000000, scale, halfHeight), -xToNdc (xOffset, 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 0.000000000000000, scale, halfHeight), -xToNdc (xOffset, 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 0.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 9.000000000000000, scale, halfWidth), 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 10.000000000000000, scale, halfHeight), -endXToNdc (xOffset, xToNdc (xOffset, 9.000000000000000, scale, halfWidth), 9.000000000000000, scale, halfWidth), -yToNdc (yOffset, 0.000000000000000, scale, halfHeight) - ] - end -end