add 'numClickPoints' field to app type, and add parameter with same name to

ClickPoints.generate function
This commit is contained in:
2024-09-20 21:33:35 +01:00
parent 2816ff0875
commit 2098a4eda7
7 changed files with 72 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
signature CLICK_POINTS =
sig
val generate: int * int -> Real32.real vector
val generate: int * int * int -> Real32.real vector
val getClickPositionFromMouse: AppType.app_type -> (int * int) option
val getDrawDot:
Real32.real
@@ -18,13 +18,14 @@ end
structure ClickPoints :> CLICK_POINTS =
struct
fun generate (start, finish) =
fun generate (start, finish, numPoints) =
let
val difference = finish - start
val increment = Real32.fromInt difference / 40.0
val increment = Real32.fromInt difference / Real32.fromInt numPoints
val start = Real32.fromInt start
in
Vector.tabulate (41, fn idx => (Real32.fromInt idx * increment) + start)
Vector.tabulate (numPoints + 1, fn idx =>
(Real32.fromInt idx * increment) + start)
end
(*