Working room generation with less shifting, should be more sensible
This commit is contained in:
+1
-17
@@ -49,11 +49,6 @@ placeSpot (w,rm) plmnt = case plmnt of
|
||||
where
|
||||
shift = _rmShift rm
|
||||
|
||||
invShiftPSBy :: (Point2,Float) -> PlacementSpot -> PlacementSpot
|
||||
invShiftPSBy (pos,rot) (PS p r) = PS (invShiftPointBy (pos,rot) p) (r - rot)
|
||||
invShiftPSBy _ ps = ps
|
||||
|
||||
|
||||
-- this should be tidied up
|
||||
placeSpotUsingLink :: World -> Room -> Placement
|
||||
-> (RoomPos -> Maybe PlacementSpot)
|
||||
@@ -67,7 +62,7 @@ placeSpotUsingLink w rm plmnt extract eff fallback = case searchedPoss (_rmPos r
|
||||
Just plmnt' -> placeSpot (w,rm) plmnt'
|
||||
where
|
||||
searchedPoss [] = error "no correct pos type for lnk placement"
|
||||
searchedPoss (pos:poss) = case extract (invShiftPosBy (_rmShift rm) pos) of
|
||||
searchedPoss (pos:poss) = case extract pos of
|
||||
Nothing -> second (pos:) <$> searchedPoss poss
|
||||
Just ps -> Just ( ps,pos, poss)
|
||||
|
||||
@@ -135,17 +130,6 @@ shiftPointBy (pos,rot) p = pos +.+ rotateV rot p
|
||||
invShiftPointBy :: (Point2,Float) -> Point2 -> Point2
|
||||
invShiftPointBy (p1,r) p2 = rotateV (-r) $ p2 -.- p1
|
||||
|
||||
invShiftPosBy :: (Point2,Float) -> RoomPos -> RoomPos
|
||||
invShiftPosBy s rp = case rp of
|
||||
OutLink i p a -> uncurry (OutLink i) $ invShiftLinkBy s (p,a)
|
||||
InLink p a -> uncurry (InLink) $ invShiftLinkBy s (p,a)
|
||||
UnusedLink p a -> uncurry (UnusedLink) $ invShiftLinkBy s (p,a)
|
||||
PosPl p a -> uncurry (PosPl) $ invShiftLinkBy s (p,a)
|
||||
LabPos i rp' -> LabPos i $ invShiftPosBy s rp'
|
||||
|
||||
invShiftLinkBy :: (Point2,Float) -> (Point2,Float) -> (Point2,Float)
|
||||
invShiftLinkBy (pos,rot) (p,r) = (invShiftPointBy (pos,rot) p, r - rot)
|
||||
|
||||
shiftPoint3By :: (Point2,Float) -> Point3 -> Point3
|
||||
shiftPoint3By (pos,rot) (V3 x y z) = addZ z $ pos +.+ rotateV rot (V2 x y)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user