improve graph lines

This commit is contained in:
2025-07-06 17:50:46 +01:00
parent 6a6a36a277
commit dc2a52bcc8
5 changed files with 109 additions and 121 deletions

View File

@@ -1,5 +1,36 @@
structure ClickPoints =
struct
fun helpMakeOne (start, finish, numPoints, point) =
let
val difference = finish - start
val increment = Real32.fromInt difference / Real32.fromInt numPoints
val start = Real32.fromInt start
in
(Real32.fromInt point * increment) + start
end
fun makeOne (windowWidth, windowHeight, numPoints, point) =
if windowWidth > windowHeight then
let
val difference = windowWidth - windowHeight
val half = difference div 2
val widthStart = half
val widthFinish = windowWidth - half
in
helpMakeOne (widthStart, widthFinish, numPoints, point)
end
else if windowHeight > windowWidth then
let
val difference = windowHeight - windowWidth
val half = difference div 2
val heightStart = half
val heightFinish = windowHeight - half
in
helpMakeOne (heightStart, heightFinish, numPoints, point)
end
else
helpMakeOne (0, windowWidth, numPoints, point)
fun generate (start, finish, numPoints) =
let
val difference = finish - start