cubicbezier-0.2.0: Efficient manipulating of 2D cubic bezier curves.

Safe HaskellSafe-Inferred

Geom2D

Description

Basic 2 dimensional geometry functions.

Synopsis

Documentation

data Point Source

Constructors

Point 

Fields

pointX :: !Double
 
pointY :: !Double
 

data Transform Source

A transformation (x, y) -> (ax + by + c, dx + ey + d)

Constructors

Transform 

Fields

xformA :: !Double
 
xformB :: !Double
 
xformC :: !Double
 
xformD :: !Double
 
xformE :: !Double
 
xformF :: !Double
 

data Line Source

Constructors

Line Point Point 

data Polygon Source

Constructors

Polygon [Point] 

($*) :: AffineTransform a => Transform -> a -> aSource

Operator for applying a transformation.

inverse :: Transform -> Maybe TransformSource

Calculate the inverse of 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.

vectorMag :: Point -> DoubleSource

The lenght of the vector.

vectorAngle :: Point -> DoubleSource

The angle of the vector, in the range (-pi, pi].

dirVector :: Double -> PointSource

The unitvector with the given angle.

normVector :: Point -> PointSource

The unit vector with the same direction.

(*^) :: Double -> Point -> PointSource

Scale vector by constant.

(^/) :: Point -> Double -> PointSource

Scale vector by reciprocal of constant.

(^*) :: Point -> Double -> PointSource

Scale vector by constant, with the arguments swapped.

(^+^) :: Point -> Point -> PointSource

Add two vectors.

(^-^) :: Point -> Point -> PointSource

Subtract two vectors.

(^.^) :: Point -> Point -> DoubleSource

Dot product of two vectors.

vectorCross :: Point -> Point -> DoubleSource

Cross product of two vectors.

vectorDistance :: Point -> Point -> DoubleSource

Distance between two vectors.

interpolateVector :: Point -> Point -> Double -> PointSource

Interpolate between two vectors.

rotateVec :: Point -> TransformSource

Create a transform that rotates by the angle of the given vector with the x-axis

rotate :: Double -> TransformSource

Create a transform that rotates by the given angle (radians).

rotate90L :: TransformSource

Rotate vector 90 degrees left.

rotate90R :: TransformSource

Rotate vector 90 degrees right.

translate :: Point -> TransformSource

Create a transform that translates by the given vector.