progress with aligning graph lines
This commit is contained in:
@@ -1,44 +1,12 @@
|
||||
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
|
||||
val increment = Real32.fromInt difference / Real32.fromInt numPoints
|
||||
val start = Real32.fromInt start
|
||||
in
|
||||
Vector.tabulate (numPoints + 1, fn idx =>
|
||||
(Real32.fromInt idx * increment) + start)
|
||||
(Real32.fromInt idx * increment))
|
||||
end
|
||||
|
||||
fun getClickPos (clickPoints, mousePos, idx) =
|
||||
|
||||
Reference in New Issue
Block a user