Unify RoomPos constructors
This commit is contained in:
+16
-10
@@ -215,17 +215,23 @@ gameRoomFromRoom rm = GameRoom
|
||||
[p +.+ 10 *.* unitVectorAtAngle a
|
||||
,p -.- 10 *.* unitVectorAtAngle a
|
||||
]
|
||||
filterUnusedLinks (UnusedLink p _ _ _) = Just p
|
||||
filterUnusedLinks _ = Nothing
|
||||
filterUsedLinks (UsedOutLink _ _ p a _ _) = doubleShift p a
|
||||
filterUsedLinks (UsedInLink _ p a _ _) = doubleShift p a
|
||||
filterUsedLinks _ = []
|
||||
undir (UsedOutLink _ _ _ a _ _) = Just $ 0.5*pi + a + snd (_rmShift rm)
|
||||
undir (UsedInLink _ _ a _ _) = Just $ 0.5*pi + a + snd (_rmShift rm)
|
||||
undir _ = Nothing
|
||||
filterUnusedLinks rp = case _rpLinkStatus rp of
|
||||
UnusedLink{} -> Just $ _rpPos rp
|
||||
_ -> Nothing
|
||||
filterUsedLinks rp = case _rpLinkStatus rp of
|
||||
UsedOutLink{} -> doubleShift (_rpPos rp) (_rpDir rp)
|
||||
UsedInLink{} -> doubleShift (_rpPos rp) (_rpDir rp)
|
||||
_ -> []
|
||||
undir rp = case _rpLinkStatus rp of
|
||||
UsedOutLink{} -> ma
|
||||
UsedInLink{} -> ma
|
||||
_ -> Nothing
|
||||
where
|
||||
ma = Just $ 0.5*pi + (_rpDir rp) + snd (_rmShift rm)
|
||||
closePoints x y = roundPoint2 x == roundPoint2 y
|
||||
getDir (UsedInLink _ _ a _ _:_) = a + snd (_rmShift rm)
|
||||
getDir (_:xs) = getDir xs
|
||||
getDir (rp:xs) = case _rpLinkStatus rp of
|
||||
UsedInLink {} -> _rpDir rp + snd (_rmShift rm)
|
||||
_ -> getDir xs
|
||||
getDir _ = 0 -- fallback
|
||||
|
||||
floorsFromRooms :: [Room] -> [(Point3,Point3)]
|
||||
|
||||
Reference in New Issue
Block a user