Copyright  Written by David Himmelstrup 

License  Unlicense 
Maintainer  lemmih@gmail.com 
Stability  experimental 
Portability  POSIX 
Safe Haskell  None 
Language  Haskell2010 
Lowlevel primitives related to computational geometry.
Synopsis
 newtype Ring a = Ring (Vector (V2 a))
 ringSize :: Ring a > Int
 ringAccess :: Ring a > Int > V2 a
 ringClamp :: Ring a > Int > Int
 ringUnpack :: Ring a > Vector (V2 a)
 ringPack :: Vector (V2 a) > Ring a
 ringMap :: (V2 a > V2 b) > Ring a > Ring b
 ringRayIntersect :: Ring Rational > (Int, Int) > (Int, Int) > Maybe (V2 Rational)
 area :: Fractional a => V2 a > V2 a > V2 a > a
 area2X :: Fractional a => V2 a > V2 a > V2 a > a
 isLeftTurn :: (Fractional a, Ord a, Epsilon a) => V2 a > V2 a > V2 a > Bool
 isLeftTurnOrLinear :: (Fractional a, Ord a, Epsilon a) => V2 a > V2 a > V2 a > Bool
 isRightTurn :: (Fractional a, Ord a, Epsilon a) => V2 a > V2 a > V2 a > Bool
 isRightTurnOrLinear :: (Fractional a, Ord a, Epsilon a) => V2 a > V2 a > V2 a > Bool
 direction :: Num a => V2 a > V2 a > V2 a > a
 isInside :: (Fractional a, Ord a) => V2 a > V2 a > V2 a > V2 a > Bool
 isInsideStrict :: (Fractional a, Ord a) => V2 a > V2 a > V2 a > V2 a > Bool
 barycentricCoords :: Fractional a => V2 a > V2 a > V2 a > V2 a > (a, a, a)
 rayIntersect :: (Fractional a, Ord a) => (V2 a, V2 a) > (V2 a, V2 a) > Maybe (V2 a)
 isBetween :: (Ord a, Fractional a) => V2 a > (V2 a, V2 a) > Bool
 lineIntersect :: (Ord a, Fractional a) => (V2 a, V2 a) > (V2 a, V2 a) > Maybe (V2 a)
 distSquared :: Num a => V2 a > V2 a > a
 approxDist :: (Real a, Fractional a) => V2 a > V2 a > a
 distance' :: (Real a, Fractional a) => V2 a > V2 a > Double
 triangleAngles :: V2 Double > V2 Double > V2 Double > (Double, Double, Double)
 class Num a => Epsilon a where
Ring
ringRayIntersect :: Ring Rational > (Int, Int) > (Int, Int) > Maybe (V2 Rational) Source #
Compute the intersection of two pairs of nodes in the ring.
Math
area2X :: Fractional a => V2 a > V2 a > V2 a > a Source #
Compute 2x area of triangle. This avoids a division.
isLeftTurn :: (Fractional a, Ord a, Epsilon a) => V2 a > V2 a > V2 a > Bool Source #
Return True
iff the line from p1
to p2
makes a leftturn to p3
.
isLeftTurnOrLinear :: (Fractional a, Ord a, Epsilon a) => V2 a > V2 a > V2 a > Bool Source #
Return True
iff the line from p1
to p2
does not make a rightturn to p3
.
isRightTurn :: (Fractional a, Ord a, Epsilon a) => V2 a > V2 a > V2 a > Bool Source #
Return True
iff the line from p1
to p2
makes a rightturn to p3
.
isRightTurnOrLinear :: (Fractional a, Ord a, Epsilon a) => V2 a > V2 a > V2 a > Bool Source #
Return True
iff the line from p1
to p2
does not make a leftturn to p3
.
direction :: Num a => V2 a > V2 a > V2 a > a Source #
Compute the change in direction in a line between the three points.
isInside :: (Fractional a, Ord a) => V2 a > V2 a > V2 a > V2 a > Bool Source #
Returns True
if the fourth argument is inside the triangle or
on the border.
isInsideStrict :: (Fractional a, Ord a) => V2 a > V2 a > V2 a > V2 a > Bool Source #
Returns True
iff the fourth argument is inside the triangle.
barycentricCoords :: Fractional a => V2 a > V2 a > V2 a > V2 a > (a, a, a) Source #
Compute relative coordinates inside the triangle. Invariant: a+b+c=1
rayIntersect :: (Fractional a, Ord a) => (V2 a, V2 a) > (V2 a, V2 a) > Maybe (V2 a) Source #
Compute intersection of two infinite lines.
isBetween :: (Ord a, Fractional a) => V2 a > (V2 a, V2 a) > Bool Source #
Returns True
iff a point is on a line segment.
lineIntersect :: (Ord a, Fractional a) => (V2 a, V2 a) > (V2 a, V2 a) > Maybe (V2 a) Source #
Compute intersection of two line segments.
distSquared :: Num a => V2 a > V2 a > a Source #
Compute the square of the distance between two points.
approxDist :: (Real a, Fractional a) => V2 a > V2 a > a Source #
Approximate the distance between two points.
distance' :: (Real a, Fractional a) => V2 a > V2 a > Double Source #
Approximate the distance between two points.
triangleAngles :: V2 Double > V2 Double > V2 Double > (Double, Double, Double) Source #
Approximate the angles of a triangle.
class Num a => Epsilon a where #
Provides a fairly subjective test to see if a quantity is near zero.
>>>
nearZero (1e11 :: Double)
False
>>>
nearZero (1e17 :: Double)
True
>>>
nearZero (1e5 :: Float)
False
>>>
nearZero (1e7 :: Float)
True
Instances
Epsilon Double 

Defined in Linear.Epsilon  
Epsilon Float 

Defined in Linear.Epsilon  
Epsilon Rational Source #  
Defined in Reanimate.Math.Common  
Epsilon CFloat 

Defined in Linear.Epsilon  
Epsilon CDouble 

Defined in Linear.Epsilon  
(Epsilon a, RealFloat a) => Epsilon (Complex a)  
Defined in Linear.Epsilon  
Epsilon a => Epsilon (Plucker a)  
Defined in Linear.Plucker  
(RealFloat a, Epsilon a) => Epsilon (Quaternion a)  
Defined in Linear.Quaternion nearZero :: Quaternion a > Bool #  
Epsilon (V0 a)  
Epsilon a => Epsilon (V4 a)  
Epsilon a => Epsilon (V3 a)  
Epsilon a => Epsilon (V2 a)  
Epsilon a => Epsilon (V1 a)  
Epsilon (f a) => Epsilon (Point f a)  
Defined in Linear.Affine  
(Dim n, Epsilon a) => Epsilon (V n a)  