Safe Haskell | Safe-Inferred |
---|
Basic 2 dimensional geometry functions.
- data Point = Point {}
- data Transform = Transform {}
- data Line = Line Point Point
- data Polygon = Polygon [Point]
- class AffineTransform a where
- ($*) :: AffineTransform a => Transform -> a -> a
- inverse :: Transform -> Maybe Transform
- lineEquation :: Line -> (Double, Double, Double)
- lineDistance :: Line -> Point -> Double
- vectorMag :: Point -> Double
- vectorAngle :: Point -> Double
- dirVector :: Double -> Point
- normVector :: Point -> Point
- (*^) :: Double -> Point -> Point
- (^/) :: Point -> Double -> Point
- (^*) :: Point -> Double -> Point
- (^+^) :: Point -> Point -> Point
- (^-^) :: Point -> Point -> Point
- (^.^) :: Point -> Point -> Double
- vectorCross :: Point -> Point -> Double
- vectorDistance :: Point -> Point -> Double
- interpolateVector :: Point -> Point -> Double -> Point
- rotateVec :: Point -> Transform
- rotate :: Double -> Transform
- rotate90L :: Transform
- rotate90R :: Transform
- translate :: Point -> Transform
Documentation
A transformation (x, y) -> (ax + by + c, dx + ey + d)
class AffineTransform a whereSource
($*) :: AffineTransform a => Transform -> a -> aSource
Operator for applying a transformation.
lineEquation :: Line -> (Double, Double, Double)Source
Return the parameters (a, b, c) for the normalised equation
of the line: a*x + b*y + c = 0
.
lineDistance :: Line -> Point -> DoubleSource
Return the the distance from a point to the line.
normVector :: Point -> PointSource
The unit vector with the same direction.
vectorCross :: Point -> Point -> DoubleSource
Cross product of two vectors.
vectorDistance :: Point -> Point -> DoubleSource
Distance between two vectors.