done with code to generate graph lines (but I still need to send new graph lines vector as a DrawMsg)

This commit is contained in:
2024-08-03 02:56:45 +01:00
parent d946addb81
commit 5a14f5300b
2 changed files with 32 additions and 33 deletions

BIN
dotscape

Binary file not shown.

View File

@@ -144,19 +144,18 @@ struct
helpGenGraphLinesSquare (nextPos, limit, acc) helpGenGraphLinesSquare (nextPos, limit, acc)
end end
fun helpGenGraphLinesVertical (pos, limit, acc) = fun helpGenGraphLinesVertical (pos, limit, acc, xMin, xMax) =
if pos <= limit + 0.01 then if pos <= limit + 0.01 then
let let
val vec = Vector.fromList val vec = Vector.fromList
[ (* y = _.1 *) [ (* y = _.1 *)
~1.0, pos - 0.002 xMin, pos - 0.002
, ~1.0, pos + 0.002 , xMin, pos + 0.002
, 1.0, pos + 0.002 , xMax, pos + 0.002
, 1.0, pos + 0.002
, 1.0, pos - 0.002
, ~1.0, pos - 0.002
, xMax, pos + 0.002
, xMax, pos - 0.002
, xMin, pos - 0.002
] ]
val acc = vec :: acc val acc = vec :: acc
val pos = pos + 0.05 val pos = pos + 0.05
@@ -165,18 +164,18 @@ struct
let let
val vec = Vector.fromList val vec = Vector.fromList
[ (* y = _.05 *) [ (* y = _.05 *)
~1.0, pos - 0.001 xMin, pos - 0.001
, ~1.0, pos + 0.001 , xMin, pos + 0.001
, 1.0, pos + 0.001 , xMax, pos + 0.001
, 1.0, pos + 0.001 , xMax, pos + 0.001
, 1.0, pos - 0.001 , xMax, pos - 0.001
, ~1.0, pos - 0.001 , xMin, pos - 0.001
] ]
val acc = vec :: acc val acc = vec :: acc
val pos = pos + 0.05 val pos = pos + 0.05
in in
helpGenGraphLinesVertical (pos, limit, acc) helpGenGraphLinesVertical (pos, limit, acc, xMin, xMax)
end end
else else
acc acc
@@ -184,19 +183,19 @@ struct
else else
acc acc
fun helpGenGraphLinesHorizontal (pos, limit, acc) = fun helpGenGraphLinesHorizontal (pos, limit, acc, yMin, yMax) =
if pos <= limit + 0.01 then if pos <= limit + 0.01 then
let let
val pos2 = pos + 0.05 val pos2 = pos + 0.05
val vec = Vector.fromList val vec = Vector.fromList
[ (* x = _.1 *) [ (* x = _.1 *)
pos - 0.002, ~1.0 pos - 0.002, yMin
, pos + 0.002, ~1.0 , pos + 0.002, yMin
, pos + 0.002, 1.0 , pos + 0.002, yMax
, pos + 0.002, 1.0 , pos + 0.002, yMax
, pos - 0.002, 1.0 , pos - 0.002, yMax
, pos - 0.002, ~1.0 , pos - 0.002, yMin
] ]
val acc = vec :: acc val acc = vec :: acc
val pos = pos + 0.05 val pos = pos + 0.05
@@ -206,18 +205,18 @@ struct
val vec = Vector.fromList val vec = Vector.fromList
[ [
(* x = _.05 *) (* x = _.05 *)
pos2 - 0.001, ~1.0 pos2 - 0.001, yMin
, pos2 + 0.001, ~1.0 , pos2 + 0.001, yMin
, pos2 + 0.001, 1.0 , pos2 + 0.001, yMax
, pos2 + 0.001, 1.0 , pos2 + 0.001, yMax
, pos2 - 0.001, 1.0 , pos2 - 0.001, yMax
, pos2 - 0.001, ~1.0 , pos2 - 0.001, yMin
] ]
val acc = vec :: acc val acc = vec :: acc
val pos = pos + 0.05 val pos = pos + 0.05
in in
helpGenGraphLinesHorizontal (pos, limit, acc) helpGenGraphLinesHorizontal (pos, limit, acc, yMin, yMax)
end end
else else
acc acc
@@ -240,8 +239,8 @@ struct
val finish = (windowWidth - offset) - (windowWidth div 2) val finish = (windowWidth - offset) - (windowWidth div 2)
val finish = Real32.fromInt finish / halfWidth val finish = Real32.fromInt finish / halfWidth
val lines = helpGenGraphLinesHorizontal (start, finish, []) val lines = helpGenGraphLinesHorizontal (start, finish, [], ~1.0, 1.0)
val lines = helpGenGraphLinesVertical (~1.0, 1.0, lines) val lines = helpGenGraphLinesVertical (~1.0, 1.0, lines, start, finish)
in in
Vector.concat lines Vector.concat lines
end end
@@ -259,8 +258,8 @@ struct
else else
1.0 + ndcOffset 1.0 + ndcOffset
val lines = helpGenGraphLinesHorizontal (~1.0, 1.0, []) val lines = helpGenGraphLinesHorizontal (~1.0, 1.0, [], start, finish)
val lines = helpGenGraphLinesVertical (start, finish, lines) val lines = helpGenGraphLinesVertical (start, finish, lines, ~1.0, 1.0)
in in
Vector.concat lines Vector.concat lines
end end