add function to convert from absolute pixel value to NDC

This commit is contained in:
2025-07-06 03:35:36 +01:00
parent ed64b464c8
commit a919e3d3d4
2 changed files with 2 additions and 2 deletions

BIN
dotscape

Binary file not shown.

View File

@@ -24,7 +24,7 @@ struct
fun fromPixelX (xpos, windowWidth, windowHeight) =
let
val halfWidth = (Real32.fromInt windowWidth) / 2.0
val halfWidth = Real32.fromInt (windowWidth div 2)
val xpos = xpos - halfWidth
in
if windowWidth > windowHeight then
@@ -40,7 +40,7 @@ struct
fun fromPixelY (ypos, windowWidth, windowHeight) =
let
val halfHeight = (Real32.fromInt windowHeight) / 2.0
val halfHeight = Real32.fromInt (windowHeight div 2)
val ypos = ~(ypos - halfHeight)
in
if windowHeight > windowWidth then