Clear all warnings
This commit is contained in:
+11
-13
@@ -24,7 +24,7 @@ import Geometry.Vector
|
||||
import Data.Function
|
||||
import Data.List
|
||||
import Data.Maybe
|
||||
import Control.Applicative
|
||||
--import Control.Applicative
|
||||
-- | Return a point a distance away from a first point towards a second point.
|
||||
-- Does not go past the second point.
|
||||
alongSegBy :: Float -> Point2 -> Point2 -> Point2
|
||||
@@ -68,11 +68,12 @@ rectWdthHght w h = rectNSWE h (-h) (-w) w
|
||||
-- polygon are listed in anticlockwise order.
|
||||
pointInOrOnPolygon :: Point2 -> [Point2] -> Bool
|
||||
pointInOrOnPolygon !p (x:xs) = all (\l -> not (uncurry isRHS l p)) $ zip (x:xs) (xs ++ [x])
|
||||
pointInOrOnPolygon _ _ = undefined
|
||||
-- | Test whether a point is strictly inside a polygon.
|
||||
-- Supposes the points in the polygon are listed in anticlockwise order.
|
||||
pointInPolygon :: Point2 -> [Point2] -> Bool
|
||||
pointInPolygon !p [] = False
|
||||
pointInPolygon !p (x:xs) = all (\l -> uncurry (errorIsLHS 1) l p) $ zip (x:xs) (xs ++ [x])
|
||||
pointInPolygon _ [] = False
|
||||
-- | Debug version of 'pointInPolygon'.
|
||||
errorPointInPolygon :: Int -> Point2 -> [Point2] -> Bool
|
||||
errorPointInPolygon !i !p xs
|
||||
@@ -83,12 +84,12 @@ errorPointInPolygon !i !p xs
|
||||
-- | Debug version of 'normalizeV'.
|
||||
errorNormalizeV :: Int -> Point2 -> Point2
|
||||
errorNormalizeV !i (0,0) = error $ "problem with function: errorNormalizeV "++show i
|
||||
errorNormalizeV !i !p = normalizeV p
|
||||
errorNormalizeV _ !p = normalizeV p
|
||||
-- | Debug version of 'angleVV'.
|
||||
errorAngleVV :: Int -> Point2 -> Point2 -> Float
|
||||
errorAngleVV !i (0,0) _ = error $ "problem with function: errorAngleVV "++show i
|
||||
errorAngleVV !i _ (0,0) = error $ "problem with function: errorAngleVV "++show i
|
||||
errorAngleVV !i !p !p' = angleVV p p'
|
||||
errorAngleVV _ !p !p' = angleVV p p'
|
||||
-- | Debug version of 'isLHS'.
|
||||
errorIsLHS :: Int -> Point2 -> Point2 -> Point2 -> Bool
|
||||
errorIsLHS !i !x !y
|
||||
@@ -101,9 +102,9 @@ errorClosestPointOnLine !i !x !y
|
||||
| otherwise = closestPointOnLine x y
|
||||
-- | Debug version of 'closestPointOnLineParam'
|
||||
errorClosestPointOnLineParam :: Int -> Point2 -> Point2 -> Point2 -> Float
|
||||
errorClosestPointOnLineParam !i !x! y! z
|
||||
errorClosestPointOnLineParam _ !x! y! z
|
||||
| x == y = dist x z
|
||||
| otherwise = closestPointOnLineParam x y z
|
||||
| otherwise = closestPointOnLineParam x y z
|
||||
-- | Test whether a point is on the LHS of a line.
|
||||
-- Returns False if the line is of zero length.
|
||||
isLHS
|
||||
@@ -250,9 +251,6 @@ diffAngles x y
|
||||
| otherwise = diffAngles (x + 2*pi) y
|
||||
where
|
||||
diff = x-y
|
||||
|
||||
differenceAngles = diffAngles
|
||||
angleDifference = diffAngles
|
||||
-- | Given a triangle where we know the length of a first side,
|
||||
-- the length of a second side, and the angle between the first side and the
|
||||
-- third side, finds the length of the third side.
|
||||
@@ -358,7 +356,7 @@ divideLine x a b = take 5000
|
||||
where
|
||||
d = dist a b
|
||||
numPoints = max 1 $ ceiling $ d / x
|
||||
ns = [0 .. numPoints]
|
||||
ns = [0 :: Int .. numPoints]
|
||||
-- | As 'divideLine', but must return an odd number of points.
|
||||
divideLineOddNumPoints :: Float -> Point2 -> Point2 -> [Point2]
|
||||
--divideLine x a b = map (\i -> a +.+ (i / (fromIntegral numPoints)) *.* (b -.- a))
|
||||
@@ -371,7 +369,7 @@ divideLineOddNumPoints x a b = take 5000
|
||||
numPoints
|
||||
| even numPoints' = numPoints'
|
||||
| otherwise = numPoints' + 1
|
||||
ns = [0 .. numPoints]
|
||||
ns = [0 .. numPoints] :: [Int]
|
||||
-- | Given two pairs of Ints, returns a list of pairs of Ints that form
|
||||
-- a digital line between them.
|
||||
digitalLine :: (Int,Int) -> (Int,Int) -> [(Int,Int)]
|
||||
@@ -386,7 +384,7 @@ digitalLine (x1,y1) (x2,y2)
|
||||
| y <- intervalList y1 y2
|
||||
]
|
||||
where
|
||||
rdiv a b = round $ fromIntegral a / fromIntegral b
|
||||
rdiv a b = round $ fromIntegral a / (fromIntegral b :: Float)
|
||||
-- | Given two pairs of 'Int's, create a list of pairs of 'Int's that form a
|
||||
-- rectangle between them.
|
||||
digitalRect :: (Int,Int) -> (Int,Int) -> [(Int,Int)]
|
||||
@@ -447,7 +445,7 @@ arcStepwisePositive ssize a cen v = (cen +.+) . (`rotateV` v) <$> rots
|
||||
-- loop.
|
||||
makeLoopPairs :: [Point2] -> [(Point2,Point2)]
|
||||
makeLoopPairs [] = error "tried to make loop with empty list of points"
|
||||
makeLoopPairs [x] = error "tried to make loop with singleton list of points"
|
||||
makeLoopPairs [_] = error "tried to make loop with singleton list of points"
|
||||
makeLoopPairs (x:xs) = zip (x:xs) (xs ++ [x])
|
||||
-- | Test whether a point is in a cone.
|
||||
-- Note the pair is ordered.
|
||||
|
||||
Reference in New Issue
Block a user