Reogranise drawing in main
This commit is contained in:
@@ -40,18 +40,17 @@ wallBuffer = 3
|
||||
|
||||
-- the following tests whether or not a point is on a wall, and if so pushes it
|
||||
-- out from the wall
|
||||
-- If the resultant push out is itself on another wall, the original point is
|
||||
-- returned
|
||||
-- this is then repeated if the point ends up on a new wall
|
||||
collideWalls :: Float -> Point2 -> [[Point2]] -> Point2 -> Point2
|
||||
collideWalls rad cp1 walls cp2
|
||||
= case (listToMaybe.mapMaybe (pushOutFromWall rad cp2)) walls of
|
||||
Nothing -> cp2
|
||||
Just cp3 -> case (listToMaybe.reverse.mapMaybe (pushOutFromWall rad cp3)) walls of
|
||||
Nothing -> cp3
|
||||
Just cp4 -> cp1
|
||||
Just cp4 -> cp4
|
||||
|
||||
-- pushes a point out from a list of walls
|
||||
-- if multiple new points occur, chooses the one closest to the orignal pointjk
|
||||
-- if multiple new points occur, chooses the one closest to the orignal point
|
||||
pushOutFromWalls :: Float -> [[Point2]] -> Point2 -> Point2
|
||||
pushOutFromWalls rad walls p =
|
||||
fromMaybe p
|
||||
|
||||
Reference in New Issue
Block a user