finished coding export string, I think/hope
This commit is contained in:
@@ -524,12 +524,14 @@ struct
|
||||
val g = colToRealString g
|
||||
val b = colToRealString b
|
||||
|
||||
val x = String.concat ["((", x, " - halfWidth) / halfWidth)"]
|
||||
val y = String.concat ["(~(", y, " - halfHeight) / halfHeight)"]
|
||||
val x = String.concat ["(((x + ", x, ") - halfWidth) / halfWidth)"]
|
||||
val y = String.concat ["(~(y + ", y, ") - halfHeight) / halfHeight)"]
|
||||
|
||||
val ex = String.concat
|
||||
[ "((((("
|
||||
, "("
|
||||
, ex
|
||||
, "+ x)"
|
||||
, " - "
|
||||
, x
|
||||
, ") "
|
||||
@@ -544,7 +546,9 @@ struct
|
||||
, "("
|
||||
, "("
|
||||
, "("
|
||||
, "("
|
||||
, ey
|
||||
, "+ y)"
|
||||
, " - "
|
||||
, y
|
||||
, ")"
|
||||
@@ -554,14 +558,9 @@ struct
|
||||
]
|
||||
in
|
||||
(* based on triangle order formed by `Ndc.ltrbToVertexRgb` function *)
|
||||
x :: ey :: r :: g :: b ::
|
||||
ex :: ey :: r :: g :: b ::
|
||||
x :: y :: r :: g :: b ::
|
||||
|
||||
x :: y :: r :: g :: b ::
|
||||
ex :: ey :: r :: g :: b ::
|
||||
ex :: y :: r :: g :: b ::
|
||||
acc
|
||||
x :: ey :: r :: g :: b :: ex :: ey :: r :: g :: b :: x :: y :: r :: g :: b
|
||||
:: x :: y :: r :: g :: b :: ex :: ey :: r :: g :: b :: ex :: y :: r :: g
|
||||
:: b :: acc
|
||||
end
|
||||
|
||||
fun toExportString (squares, canvasWidth, canvasHeight) =
|
||||
@@ -573,8 +572,17 @@ struct
|
||||
val coords = BinTree.foldr (toExportStringFolder, bintree, [])
|
||||
val coords = String.concatWith "," coords
|
||||
|
||||
val header = ""
|
||||
val footer = ""
|
||||
val header = String.concat
|
||||
[ "structure AAA = \nstruct\n"
|
||||
, " fun lerp (x, y, scale, windowWidth, windowHeight) =\n"
|
||||
, " let\n"
|
||||
, " val halfWidth = Real32.fromInt windowWidth / 2.0\n"
|
||||
, " val halfHeight = Real32.fromInt windowHeight / 2.0\n"
|
||||
, " in\n"
|
||||
, " #[\n"
|
||||
]
|
||||
|
||||
val footer = String.concat [" end\n", "end\n"]
|
||||
in
|
||||
String.concat [header, coords, footer]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user