Safe Haskell | None |
---|

- data BSpline v t
- bSpline :: Vector v a => Knots (Scalar a) -> v a -> BSpline v a
- evalBSpline :: (VectorSpace a, Fractional (Scalar a), Ord (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> Scalar a -> a
- evalNaturalBSpline :: (Fractional (Scalar a), Ord (Scalar a), VectorSpace a, Vector v a) => BSpline v a -> Scalar a -> a
- insertKnot :: (VectorSpace a, Ord (Scalar a), Fractional (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> Scalar a -> BSpline v a
- splitBSpline :: (VectorSpace a, Ord (Scalar a), Fractional (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> Scalar a -> Maybe (BSpline v a, BSpline v a)
- differentiateBSpline :: (VectorSpace a, Fractional (Scalar a), Ord (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> BSpline v a
- integrateBSpline :: (VectorSpace a, Fractional (Scalar a), Ord (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> BSpline v a
- deBoor :: (Fractional (Scalar a), Ord (Scalar a), VectorSpace a, Vector v a, Vector v (Scalar a)) => BSpline v a -> Scalar a -> [v a]

# Documentation

A B-spline, defined by a knot vector (see `Knots`

) and a sequence of control points.

(Spline (BSpline v) a, Vector v a) => ControlPoints (BSpline v) a | |

Spline (BSpline Vector) a => ControlPoints (BSpline Vector) a | |

(VectorSpace a, Fractional (Scalar a), Ord (Scalar a), Vector v a, Vector v (Scalar a)) => Spline (BSpline v) a | |

(VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline (BSpline Vector) v | |

(Eq (Scalar a), Eq (v a)) => Eq (BSpline v a) | |

(Ord (Scalar a), Ord (v a)) => Ord (BSpline v a) | |

(Show (Scalar a), Show a, Show (v a)) => Show (BSpline v a) |

bSpline :: Vector v a => Knots (Scalar a) -> v a -> BSpline v 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`

).

evalBSpline :: (VectorSpace a, Fractional (Scalar a), Ord (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> Scalar a -> aSource

Evaluate a B-spline at the given point. This uses a slightly modified version of de Boor's algorithm which is only strictly correct inside the domain of the spline. Unlike the standard algorithm, the basis functions always sum to 1, even outside the domain of the spline. This is mainly useful for "clamped" splines - the values at or outside the endpoints will always be the value of the nearest control point.

For a standard implementation of de Boor's algorithm, see `evalNaturalBSpline`

.
For a (much slower) strictly mathematically correct evaluation, see `evalReferenceBSpline`

.

evalNaturalBSpline :: (Fractional (Scalar a), Ord (Scalar a), VectorSpace a, Vector v a) => BSpline v a -> Scalar a -> aSource

Evaluate a B-spline at the given point. This uses de Boor's algorithm, which is only strictly correct inside the domain of the spline.

For a (much slower) strictly mathematically correct evaluation, see `evalReferenceBSpline`

.

insertKnot :: (VectorSpace a, Ord (Scalar a), Fractional (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> Scalar a -> BSpline v aSource

Insert one knot into a `BSpline`

without changing the spline's shape.

splitBSpline :: (VectorSpace a, Ord (Scalar a), Fractional (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> Scalar a -> Maybe (BSpline v a, BSpline v a)Source

Split a B-spline at the specified point (which must be inside the spline's domain), returning two disjoint splines, the sum of which is equal to the original. The domain of the first will be below the split point and the domain of the second will be above.

differentiateBSpline :: (VectorSpace a, Fractional (Scalar a), Ord (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> BSpline v aSource

integrateBSpline :: (VectorSpace a, Fractional (Scalar a), Ord (Scalar a), Vector v a, Vector v (Scalar a)) => BSpline v a -> BSpline v aSource

deBoor :: (Fractional (Scalar a), Ord (Scalar a), VectorSpace a, Vector v a, Vector v (Scalar a)) => BSpline v a -> Scalar a -> [v a]Source

The table from de Boor's algorithm, calculated for the entire spline. If that is not necessary
(for example, if you are only evaluating the spline), then use `slice`

on the spline first.
`splitBSpline`

currently uses the whole table. It is probably not necessary there, but it
greatly simplifies the definition and makes the similarity to splitting Bezier curves very obvious.