fix hard to find edge case in graph lines: integer division gave a visual bug, but real/float division (which preserves decimal) fixed that bug

This commit is contained in:
2025-07-11 01:45:47 +01:00
parent 024f1293c0
commit f2b1fc9e95
2 changed files with 6 additions and 8 deletions

BIN
dotscape

Binary file not shown.

View File

@@ -11,8 +11,8 @@ struct
Vector.concat acc
else
let
val halfWidth = Real32.fromInt (windowWidth div 2)
val halfHeight = Real32.fromInt (windowHeight div 2)
val halfWidth = Real32.fromInt windowWidth / 2.0
val halfHeight = Real32.fromInt windowHeight / 2.0
val curX = Vector.sub (xClickPoints, pos)
val minusX = (curX - halfWidth - 1.0) / halfWidth
@@ -35,14 +35,12 @@ struct
acc
else
let
val halfWidth = windowHeight div 2
val halfWidth = Real32.fromInt halfWidth
val halfHeight = windowHeight div 2
val halfHeight = Real32.fromInt halfHeight
val halfWidth = Real32.fromInt windowWidth / 2.0
val halfHeight = Real32.fromInt windowHeight / 2.0
val curY = Vector.sub (yClickPoints, pos)
val minusY = ~(curY - halfHeight - 1.0) / halfHeight
val plusY = ~(curY - halfHeight + 1.0) / halfHeight
val minusY = (~(curY - halfHeight - 1.0)) / halfHeight
val plusY = (~(curY - halfHeight + 1.0)) / halfHeight
val minX = Vector.sub (xClickPoints, 0)
val minX = (minX - halfWidth) / halfWidth