This commit is contained in:
2025-10-25 10:17:59 +01:00
parent c2cc38a642
commit 0da3816664
5 changed files with 119 additions and 210 deletions
+8 -15
View File
@@ -1,17 +1,10 @@
module Dodge.LevelGen.DoorPane ( rectanglePairs) where
import Geometry.Vector
import Geometry.Data
module Dodge.LevelGen.DoorPane (mkRectangle) where
rectanglePairs :: Float -> Point2 -> Point2 -> [(Point2,Point2)]
rectanglePairs wdth a b =
[ (aup, ad)
, (ad, bd)
, (bd, bu)
, (bu, aup)
]
import Geometry.Data
import Geometry.Vector
import Linear
mkRectangle :: Float -> Point2 -> [ Point2]
mkRectangle wdth b = [ n , - n , b - n , b + n ]
where
aup = a +.+ norm
ad = a -.- norm
bu = b +.+ norm
bd = b -.- norm
norm = wdth *.* normalizeV ( vNormal (b -.- a))
n = wdth *^ normalizeV (vNormal b)