Improve xIntercepts (still not perfect)

This commit is contained in:
2025-10-22 22:07:45 +01:00
parent d5f985f3ab
commit 59472b16d2
9 changed files with 316 additions and 208 deletions
+8
View File
@@ -40,6 +40,14 @@ import Linear
getNodePos :: Int -> World -> Maybe Point2
getNodePos i w = w ^? cWorld . incNode . ix i
getEdgesCrossingPoly :: [Point2] -> World -> [(Int,Int)]
getEdgesCrossingPoly ps w = filter tcross $ zonesExtract (w ^. incEdgeZoning)
$ Set.toList $ foldMap (uncurry $ zoneOfSegSet peZoneSize) $ pairs
where
pairs = loopPairs ps
tcross (i,j) = any (isJust . uncurry (intersectSegSeg (f i) (f j))) pairs
f i = w ^?! cWorld . incNode . ix i
getEdgesCrossing :: Point2 -> Point2 -> World -> [(Int,Int)]
getEdgesCrossing s e w = filter inedgecrosses $ nearSeg peZoneSize _incEdgeZoning s e w
where