typography-geometry-1.0.0: Drawings for printed text documents

Graphics.Typography.Geometry.Bezier

Description

This module contains the basic functions for manipulating Bezier curves. It is heavily based on the book by N. M. Patrikalakis and T. Maekawa, Shape Interrogation for Computer Aided Design and Manufacturing.

Synopsis

Documentation

data Curve Source

The type for representing all types of curves.

line :: Double -> Double -> Double -> Double -> CurveSource

The basic constructor for lines : a line is a degree 1 Bezier curve

bezier3 :: Double -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> CurveSource

A shortcut to define degree 3 Bezier curves from points. If the control points are a,b,c,d, the function should be called with bezier3 xa ya xb yb xc yc xd yd.

offset :: Matrix2 Double -> Curve -> [Curve]Source

Offsets a given Bezier curve with the given pen matrix. The original pen is a circle of radius one, the matrix, if inversible, is applied to it.

inter :: Curve -> Curve -> [(Double, Double, Double, Double)]Source

inter c0 c1 is a list of all possible points of intersection between curves c0 and c1 : if (u,v,w,x) is returned by inter, then curve c0 may intersect with c1 between parameter values u and v, which corresponds to parameter values between w and x for c1. The implementation guarantees that all actual solutions are found, but possibly false solutions may also be returned.

evalCurve :: Curve -> Interval -> (Interval, Interval)Source

Gives the point corresponding to the given value of the parameter

distance :: Interval -> Interval -> Curve -> IntervalSource

Pseudo-distance from a point to a curve. Is the result is smaller than 1, the point is inside the curve. If it is greater than 1, the point is outside. Else we don't know (as usual with interval arithmetic).

left :: Curve -> (Double, Double)Source

The leftmost point on a curve

bottom :: Curve -> (Double, Double)Source

The bottommost point on a curve

right :: Curve -> (Double, Double)Source

The rightmost point on a curve

top :: Curve -> (Double, Double)Source

The topmost point on a curve