Work on detecting floor items near analyser
This commit is contained in:
@@ -11,7 +11,7 @@ module Geometry.ConvexPoly (
|
||||
-- , centroid
|
||||
pointsToPoly,
|
||||
convexPolysOverlap,
|
||||
pointInPolyPoints,
|
||||
-- pointInPolyPoints,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
@@ -59,18 +59,11 @@ convexPolysOverlap cp1 cp2 =
|
||||
-- | Test whether two polygons intersect or if one is contained in the other.
|
||||
polyPointsOverlap :: [Point2] -> [Point2] -> Bool
|
||||
polyPointsOverlap (p : ps) (q : qs) =
|
||||
pointInPolyPoints p (q : qs)
|
||||
|| pointInPolyPoints q (p : ps)
|
||||
pointInPolygon p (q : qs)
|
||||
|| pointInPolygon q (p : ps)
|
||||
|| polyPointsIntersect (p : ps) (q : qs)
|
||||
polyPointsOverlap _ _ = False
|
||||
|
||||
{- | Test whether a point is strictly inside a polygon.
|
||||
Supposes the points in the polygon are listed in anticlockwise order.
|
||||
-}
|
||||
pointInPolyPoints :: Point2 -> [Point2] -> Bool
|
||||
pointInPolyPoints !p (x : xs) = all (\l -> uncurry isLHS l p) $ zip (x : xs) (xs ++ [x])
|
||||
pointInPolyPoints _ [] = False
|
||||
|
||||
polyPointsIntersect :: [Point2] -> [Point2] -> Bool
|
||||
polyPointsIntersect (a : b : xs) ps = go a (a : b : xs) ps
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user