Use tasty for tests, fix bug in circOnLine

This commit is contained in:
2021-12-14 11:50:01 +00:00
parent ec51efabca
commit 47391f3850
19 changed files with 143 additions and 113 deletions
+4 -6
View File
@@ -10,19 +10,17 @@ tileToRenderList t = polyToTris $ zip ps3 coords3
where
ps = _tilePoly t
coords = map (calcTexCoord (_tileZero t) (_tileX t)) ps
ps3 = map (addToV2 0) ps
coords3 = map (addToV2 (_tileZ t)) coords
addToV2 :: a -> V2 a -> V3 a
addToV2 z (V2 x y) = V3 x y z
ps3 = map (addZ 0) ps
coords3 = map (addZ (_tileZ t)) coords
calcTexCoord
:: Point2 -- ^ tile (0,0)
-> Point2 -- ^ tile (1,0)
-> Point2 -- ^ world point
-> Point2
calcTexCoord c p x = V2 (0.02 * dotV (p -.- c) xdir) (0.02 * dotV (p -.- c) ydir)
calcTexCoord c p x = V2 (vectorAmountIn xdir) (vectorAmountIn ydir)
where
vectorAmountIn dir = 0.02 * dotV (p -.- c) dir
xdir = x -.- c
ydir = vNormal xdir