From 024f1293c025d131a3247d84d6e6de5ccab346e5 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Fri, 11 Jul 2025 00:57:55 +0100 Subject: [PATCH] formatt a couple of files --- fcore/graph-lines.sml | 28 ++++++++++++++-------------- fcore/normal-mode.sml | 42 ++++++++++++++++++++++++++++++++---------- 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/fcore/graph-lines.sml b/fcore/graph-lines.sml index a2b93f6..bd35199 100644 --- a/fcore/graph-lines.sml +++ b/fcore/graph-lines.sml @@ -5,8 +5,8 @@ end structure GraphLines :> GRAPH_LINES = struct - fun helpGenGraphLinesX (pos, xClickPoints, yClickPoints, acc, - windowWidth, windowHeight) = + fun helpGenGraphLinesX + (pos, xClickPoints, yClickPoints, acc, windowWidth, windowHeight) = if pos = Vector.length xClickPoints then Vector.concat acc else @@ -21,7 +21,7 @@ struct val minY = Vector.sub (xClickPoints, 0) val minY = (~(minY - halfHeight)) / halfHeight val maxY = Vector.sub (xClickPoints, Vector.length xClickPoints - 1) - val maxY = (~(maxY - halfHeight)) /halfHeight + val maxY = (~(maxY - halfHeight)) / halfHeight val acc = Ndc.ltrbToVertex (minusX, maxY, plusX, minY) :: acc in @@ -29,8 +29,8 @@ struct (pos + 1, xClickPoints, yClickPoints, acc, windowWidth, windowHeight) end - fun helpGenGraphLinesY (pos, yClickPoints, xClickPoints, acc, - windowWidth, windowHeight) = + fun helpGenGraphLinesY + (pos, yClickPoints, xClickPoints, acc, windowWidth, windowHeight) = if pos = Vector.length yClickPoints then acc else @@ -56,16 +56,16 @@ struct end fun helpGenerate (windowWidth, windowHeight, xClickPoints, yClickPoints) = - let - val acc = helpGenGraphLinesY (0, yClickPoints, xClickPoints, [], windowWidth, windowHeight) - in - helpGenGraphLinesX (0, xClickPoints, yClickPoints, acc, windowWidth, windowHeight) - end - - fun generate (app: AppType.app_type) = let - val {windowWidth, windowHeight, xClickPoints, yClickPoints, ...} = app + val acc = helpGenGraphLinesY + (0, yClickPoints, xClickPoints, [], windowWidth, windowHeight) in - helpGenerate (windowWidth, windowHeight, xClickPoints, yClickPoints) + helpGenGraphLinesX + (0, xClickPoints, yClickPoints, acc, windowWidth, windowHeight) + end + + fun generate (app: AppType.app_type) = + let val {windowWidth, windowHeight, xClickPoints, yClickPoints, ...} = app + in helpGenerate (windowWidth, windowHeight, xClickPoints, yClickPoints) end end diff --git a/fcore/normal-mode.sml b/fcore/normal-mode.sml index 774adcb..56e8314 100644 --- a/fcore/normal-mode.sml +++ b/fcore/normal-mode.sml @@ -149,8 +149,7 @@ struct val xpos = Vector.sub (xClickPoints, hIdx) val ypos = Vector.sub (yClickPoints, vIdx) - val model = AppWith.addSquare - (model, hIdx, vIdx, hIdx, vIdx) + val model = AppWith.addSquare (model, hIdx, vIdx, hIdx, vIdx) val squares = #squares model val dotVec = getDotVecFromIndices (model, hIdx, vIdx) @@ -159,9 +158,16 @@ struct val halfHeight = Real32.fromInt (windowHeight div 2) val maxSide = Int.max (canvasWidth, canvasHeight) - val squares = - CollisionTree.toTriangles (windowWidth, windowHeight, squares, maxSide, - canvasWidth, canvasHeight, xClickPoints, yClickPoints) + val squares = CollisionTree.toTriangles + ( windowWidth + , windowHeight + , squares + , maxSide + , canvasWidth + , canvasHeight + , xClickPoints + , yClickPoints + ) val drawMsg = DRAW_SQUARES_AND_DOTS {squares = squares, dots = dotVec} in (model, [DRAW drawMsg]) @@ -181,13 +187,29 @@ struct let val model = AppWith.windowResize (model, width, height) - val {squares, canvasWidth, canvasHeight, showGraph, arrowX, arrowY, - xClickPoints, yClickPoints, ...} = - model + val + { squares + , canvasWidth + , canvasHeight + , showGraph + , arrowX + , arrowY + , xClickPoints + , yClickPoints + , ... + } = model val maxSide = Int.max (canvasWidth, canvasHeight) - val squares = CollisionTree.toTriangles (width, height, squares, maxSide, - canvasWidth, canvasHeight, xClickPoints, yClickPoints) + val squares = CollisionTree.toTriangles + ( width + , height + , squares + , maxSide + , canvasWidth + , canvasHeight + , xClickPoints + , yClickPoints + ) val graphLines = if showGraph then GraphLines.generate model else Vector.fromList []