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

Safe HaskellSafe-Inferred
LanguageHaskell98

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 -> a infixr 5 Source

Operator for applying a transformation.

inverse :: Transform -> Maybe Transform Source

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 -> 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

vectorMag :: Point -> Double Source

The lenght of the vector.

vectorAngle :: Point -> Double Source

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

dirVector :: Double -> Point Source

The unitvector with the given angle.

normVector :: Point -> Point Source

The unit vector with the same direction.

(*^) :: Double -> Point -> Point infixl 7 Source

Scale vector by constant.

(^/) :: Point -> Double -> Point infixl 7 Source

Scale vector by reciprocal of constant.

(^*) :: Point -> Double -> Point infixl 7 Source

Scale vector by constant, with the arguments swapped.

(^+^) :: Point -> Point -> Point infixl 6 Source

Add two vectors.

(^-^) :: Point -> Point -> Point infixl 6 Source

Subtract two vectors.

(^.^) :: Point -> Point -> Double Source

Dot product of two vectors.

vectorCross :: Point -> Point -> Double Source

Cross product of two vectors.

vectorDistance :: Point -> Point -> Double Source

Distance between two vectors.

interpolateVector :: Point -> Point -> Double -> Point Source

Interpolate between two vectors.

rotateVec :: Point -> Transform Source

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

rotate :: Double -> Transform Source

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

rotate90L :: Transform Source

Rotate vector 90 degrees left.

rotate90R :: Transform Source

Rotate vector 90 degrees right.

translate :: Point -> Transform Source

Create a transform that translates by the given vector.