This commit is contained in:
2021-11-23 21:48:01 +00:00
parent b7d6eeaa84
commit 86f363c2f9
19 changed files with 93 additions and 122 deletions
+5 -7
View File
@@ -35,11 +35,11 @@ posRms bounds (parent,_) _ [] st = case st of
-> fmap (parent:) <$> posRms bounds childi 0 ts tseq
posRms bounds parenti@(parent,_) numChild (t@(Node childi _):ts) tseq = do
printInfoCheckNum parenti numChild childi
tryParentLinks (0::Int) (_rmOutLinks parent)
tryParentLinks (0::Int) (rmOutLinks parent)
where
tryParentLinks _ [] = putStrLn "no viable link pairs, backtrack" >> return Nothing
tryParentLinks j (l:ls) = do
tryChildLinks (0::Int) (_rmInLinks $ fst childi)
tryChildLinks (0::Int) (rmInLinks $ fst childi)
where
tryChildLinks _ [] = tryParentLinks (j+1) ls
tryChildLinks numinlink (il:ils)
@@ -55,14 +55,12 @@ posRms bounds parenti@(parent,_) numChild (t@(Node childi _):ts) tseq = do
where
convexBounds = map pointsToPoly $ _rmBound r'
clipping = or (convexPolysOverlap <$> convexBounds <*> bounds)
updateparent rm = doLnkEff (lnkPosDir l) $ rm & rmOutLinks %~ delete l & rmPos %~ (uncurry (UsedOutLink numChild) (lnkPosDir l) :)
updateparent rm = doLnkEff (lnkPosDir l) $ rm & rmLinks %~ delete l & rmPos %~ (uncurry (UsedOutLink numChild) (lnkPosDir l) :)
l' = shiftLinkBy (_rmShift parent) l
r' = doRoomShift . fst $ rootLabel shiftedt
updatechild rm = rm & rmInLinks %~ delete il
updatechild rm = rm & rmLinks %~ delete il
& rmPos %~ ( (uncurry (UsedInLink 0) (lnkPosDir il):)
. (map (uncurry UnusedLink . lnkPosDir) (_rmOutLinks rm ++ newInLinks) ++) )
where
newInLinks = delete il $ _rmInLinks rm
. (map (uncurry UnusedLink . lnkPosDir) (delete il (_rmLinks rm)) ++) )
shiftedt = applyToRoot (first $ updatechild . shiftRoomShiftToLink' (lnkPosDir l') (lnkPosDir il)) t
printColumns :: [Int] -> [String] -> IO ()