additional graph lines improvements

This commit is contained in:
2025-07-10 23:54:51 +01:00
parent cda90e3f44
commit 8e8947379a
3 changed files with 7 additions and 23 deletions

BIN
dotscape

Binary file not shown.

View File

@@ -7,10 +7,10 @@ ann
"allowVectorExps true"
in
fcore/ndc.sml
fcore/graph-lines.sml
cozette-sml/fonts/cozette-ascii.mlb
end
fcore/graph-lines.sml
fcore/click-points.sml
fcore/app-init.sml
fcore/app-with.sml

View File

@@ -15,22 +15,15 @@ struct
val halfHeight = Real32.fromInt (windowHeight div 2)
val curX = Vector.sub (xClickPoints, pos)
val curXNdc = (curX - halfWidth) / halfWidth
val minusX = (curX - halfWidth - 1.0) / halfWidth
val plusX = (curX - halfWidth + 1.0) / halfWidth
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 acc =
#[ curXNdc - 0.001, minY
, curXNdc + 0.001, minY
, curXNdc + 0.001, maxY
, curXNdc + 0.001, maxY
, curXNdc - 0.001, maxY
, curXNdc - 0.001, minY
] :: acc
val acc = Ndc.ltrbToVertex (minusX, maxY, plusX, minY) :: acc
in
helpGenGraphLinesX
(pos + 1, xClickPoints, yClickPoints, acc, windowWidth, windowHeight)
@@ -48,24 +41,15 @@ struct
val halfHeight = Real32.fromInt halfHeight
val curY = Vector.sub (yClickPoints, pos)
val curYNdc =(~(curY - halfHeight)) / halfHeight
val minusY = ~(curY - halfHeight - 1.0) / halfHeight
val plusY = ~(curY - halfHeight + 1.0) / halfHeight
val minX = Vector.sub (xClickPoints, 0)
val minX = (minX - halfWidth) / halfWidth
val maxX = Vector.sub (xClickPoints, Vector.length xClickPoints - 1)
val _ = print ("maxX = " ^ Real32.toString maxX ^ "\n")
val maxX = (maxX - halfWidth) / halfWidth
val acc =
#[ minX, curYNdc - 0.001
, minX, curYNdc + 0.001
, maxX, curYNdc + 0.001
, maxX, curYNdc + 0.001
, maxX, curYNdc - 0.001
, minX, curYNdc - 0.001
] :: acc
val acc = Ndc.ltrbToVertex (minX, plusY, maxX, minusY) :: acc
in
helpGenGraphLinesY
(pos + 1, yClickPoints, xClickPoints, acc, windowWidth, windowHeight)