diff --git a/dotscape b/dotscape index f2be6a8..9453387 100755 Binary files a/dotscape and b/dotscape differ diff --git a/fcore/app-with.sml b/fcore/app-with.sml index 6a91f58..77ad23b 100644 --- a/fcore/app-with.sml +++ b/fcore/app-with.sml @@ -2,6 +2,24 @@ structure AppWith = struct open AppType + fun toList vec = Vector.foldr (fn (el, acc) => el :: acc) [] vec + + fun squaresToString squares = + let + val vec = + Vector.map (fn vec => + let + val vec = Vector.map (fn num => Int.toString num) vec + val vec: string list = toList vec + in + String.concat vec + end + ) squares + val vec = toList vec + in + String.concatWith "\n" vec + end + fun addSquare (app, newX, newY, arrowX, arrowY) : app_type = let val @@ -28,6 +46,7 @@ struct , modalNum } = app + val () = print "adding new square\n" val squares = Vector.mapi (fn (idx, el) => @@ -35,6 +54,9 @@ struct Vector.mapi (fn (iidx, iel) => if iidx = newY then 1 else iel) el else el) squares + + val msg = squaresToString squares + val () = print (msg ^ "\n") in { mode = mode , squares = squares diff --git a/fcore/normal-mode.sml b/fcore/normal-mode.sml index 626a0c7..49fb6be 100644 --- a/fcore/normal-mode.sml +++ b/fcore/normal-mode.sml @@ -150,7 +150,7 @@ struct val ypos = Vector.sub (yClickPoints, vIdx) val model = AppWith.addSquare - (model, realToInt xpos, realToInt ypos, hIdx, vIdx) + (model, hIdx, vIdx, hIdx, vIdx) val squares = #squares model val dotVec = getDotVecFromIndices (model, hIdx, vIdx) diff --git a/fcore/quad-tree.sml b/fcore/quad-tree.sml index 29d1c7a..2a8fb77 100644 --- a/fcore/quad-tree.sml +++ b/fcore/quad-tree.sml @@ -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