Safe Haskell | None |
---|
- 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 Vector 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 v t
- bSpline :: Vector v a => Knots (Scalar a) -> v a -> BSpline v 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
- data CSpline a
- cSpline :: Ord (Scalar a) => [(Scalar a, a, a)] -> CSpline a
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 BezierCurve v | |
(VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline MSpline v | |
(VectorSpace v, Fractional (Scalar v), Ord (Scalar v)) => Spline ISpline v | |
(VectorSpace a, Fractional (Scalar a), Ord (Scalar a)) => Spline CSpline 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 |
class Spline s v => ControlPoints s v whereSource
controlPoints :: s v -> Vector vSource
Spline BezierCurve v => ControlPoints BezierCurve v | |
Spline MSpline v => ControlPoints MSpline v | |
Spline ISpline v => ControlPoints ISpline v | |
(Spline (BSpline v) a, Vector v a) => ControlPoints (BSpline v) a | |
Spline (BSpline Vector) a => ControlPoints (BSpline Vector) a |
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 Bezier 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.
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
).
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
).
Cubic Hermite splines. These are cubic splines defined by a sequence of control points and derivatives at those points.
(VectorSpace a, Fractional (Scalar a), Ord (Scalar a)) => Spline CSpline a |