Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
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 where Source
($*) :: AffineTransform a => Transform -> a -> a infixr 5 Source
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 -> Double Source
Return the signed distance from a point to the line. If the distance is negative, the point lies to the right of the line
normVector :: Point -> Point Source
The unit vector with the same direction.
(^*) :: Point -> Double -> Point infixl 7 Source
Scale vector by constant, with the arguments swapped.
vectorCross :: Point -> Point -> Double Source
Cross product of two vectors.
vectorDistance :: Point -> Point -> Double Source
Distance between two vectors.