Smooth out slime splitting
There are probably possible errors from the use of cutPoly
This commit is contained in:
@@ -188,7 +188,7 @@ grahamEliminate (x : y : z : xs)
|
||||
| not $ isLHS x y z = grahamEliminate (x : z : xs)
|
||||
grahamEliminate xs = xs
|
||||
|
||||
-- this isn't the centroid of the polygon...
|
||||
-- not sure what definition of centroid is applicable here
|
||||
centroid :: (Num (f a),Functor f, Fractional a,Foldable t) => t (f a) -> f a
|
||||
centroid = L.fold $ (^/) <$> L.Fold (+) 0 id <*> L.genericLength
|
||||
|
||||
@@ -234,9 +234,15 @@ cutPolyR a b [] e x ls rs = case intersectSegLine x e a b of
|
||||
Nothing -> (reverse ls,reverse rs)
|
||||
Just p -> (reverse (p\:ls), reverse (p\:rs))
|
||||
|
||||
polyInPoly :: Point2 -> [Point2] -> [Point2] -> [Point2]
|
||||
polyInPoly p ps = mapMaybe f
|
||||
where
|
||||
f q = intersectRayPoly p q ps
|
||||
|
||||
infixr 5 \:
|
||||
(\:) :: Eq a => a -> [a] -> [a]
|
||||
(\:) x (y:ys)
|
||||
| x /= y = x:y:ys
|
||||
| otherwise = y:ys
|
||||
(\:) x [] = [x]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user