- class (VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline s v where
- splineDomain :: s v -> Maybe (Scalar v, Scalar v)
- evalSpline :: s v -> Scalar v -> v
- splineDegree :: s v -> Int
- knotVector :: s v -> Knots (Scalar v)
- toBSpline :: s v -> BSpline v
- class Spline s v => ControlPoints s v where
- controlPoints :: s v -> Vector v
- data Knots a
- mkKnots :: Ord a => [a] -> Knots a
- knots :: Knots t -> [t]
- data BezierCurve t
- bezierCurve :: Vector t -> BezierCurve t
- data BSpline t
- bSpline :: Knots (Scalar a) -> Vector a -> BSpline a
- data MSpline v
- mSpline :: Knots (Scalar a) -> Vector a -> MSpline a
- toMSpline :: Spline s v => s v -> MSpline v
- data ISpline v
- iSpline :: Knots (Scalar a) -> Vector a -> ISpline a
- toISpline :: (Spline s v, Eq v) => s v -> ISpline v
Documentation
class (VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline s v whereSource
A spline is a piecewise polynomial vector-valued function. The necessary
and sufficient instance definition is toBSpline
.
splineDomain :: s v -> Maybe (Scalar v, Scalar v)Source
Returns the domain of a spline. In the case of B-splines, this is
the domain on which a spline with this degree and knot vector has a
full basis set. In other cases, it should be no larger than
splineDomain . toBSpline
, but may be smaller. Within this domain,
evalSpline
should agree with
(not
necessarily exactly, but up to reasonable expectations of numerical
accuracy).
evalSpline
. toBSpline
evalSpline :: s v -> Scalar v -> vSource
splineDegree :: s v -> IntSource
knotVector :: s v -> Knots (Scalar v)Source
(VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline BSpline v | |
(VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline BezierCurve v | |
(VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline MSpline v | |
(VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline ISpline v |
class Spline s v => ControlPoints s v whereSource
controlPoints :: s v -> Vector vSource
Spline BSpline v => ControlPoints BSpline v | |
Spline BezierCurve v => ControlPoints BezierCurve v | |
Spline MSpline v => ControlPoints MSpline v | |
Spline ISpline v => ControlPoints ISpline v |
Knot vectors - multisets of points in a 1-dimensional space.
Returns a list of all knots (not necessarily distinct) of a knot vector in ascending order
data BezierCurve t Source
A BezierCurve curve on 0 <= x <= 1
.
Spline BezierCurve v => ControlPoints BezierCurve v | |
(VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline BezierCurve v | |
Eq t => Eq (BezierCurve t) | |
Ord t => Ord (BezierCurve t) | |
Show v => Show (BezierCurve v) |
bezierCurve :: Vector t -> BezierCurve tSource
Construct a Bezier curve from a list of control points. The degree of the curve is one less than the number of control points.
bSpline :: Knots (Scalar a) -> Vector a -> BSpline aSource
bSpline kts cps
creates a B-spline with the given knot vector and control
points. The degree is automatically inferred as the difference between the
number of spans in the knot vector (numKnots kts - 1
) and the number of
control points (length cps
).
M-Splines are B-splines normalized so that the integral of each basis function over the spline domain is 1.
mSpline :: Knots (Scalar a) -> Vector a -> MSpline aSource
mSpline kts cps
creates a M-spline with the given knot vector and control
points. The degree is automatically inferred as the difference between the
number of spans in the knot vector (numKnots kts - 1
) and the number of
control points (length cps
).
The I-Spline basis functions are the integrals of the M-splines, or alternatively the integrals of the B-splines normalized to the range [0,1]. Every I-spline basis function increases monotonically from 0 to 1, thus it is useful as a basis for monotone functions. An I-Spline curve is monotone if and only if every non-zero control point has the same sign.
iSpline :: Knots (Scalar a) -> Vector a -> ISpline aSource
iSpline kts cps
creates an I-spline with the given knot vector and control
points. The degree is automatically inferred as the difference between the
number of spans in the knot vector (numKnots kts - 1
) and the number of
control points (length cps
).