Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newtype BezierSpline n d r = BezierSpline (LSeq (1 + n) (Point d r))
- controlPoints :: Iso (BezierSpline n1 d1 r1) (BezierSpline n2 d2 r2) (LSeq (1 + n1) (Point d1 r1)) (LSeq (1 + n2) (Point d2 r2))
- fromPointSeq :: Seq (Point d r) -> BezierSpline n d r
- evaluate :: (Arity d, Ord r, Num r) => BezierSpline n d r -> r -> Point d r
- split :: forall n d r. (KnownNat n, Arity d, Ord r, Num r) => r -> BezierSpline n d r -> (BezierSpline n d r, BezierSpline n d r)
- subBezier :: (KnownNat n, Arity d, Ord r, Num r) => r -> r -> BezierSpline n d r -> BezierSpline n d r
- tangent :: (Arity d, Num r, 1 <= n) => BezierSpline n d r -> Vector d r
- approximate :: forall n d r. (KnownNat n, Arity d, Ord r, Fractional r) => r -> BezierSpline n d r -> [Point d r]
- parameterOf :: (Arity d, Ord r, Fractional r) => BezierSpline n d r -> Point d r -> r
- snap :: (Arity d, Ord r, Fractional r) => BezierSpline n d r -> Point d r -> Point d r
- pattern Bezier2 :: Point d r -> Point d r -> Point d r -> BezierSpline 2 d r
- pattern Bezier3 :: Point d r -> Point d r -> Point d r -> Point d r -> BezierSpline 3 d r
Documentation
newtype BezierSpline n d r Source #
Datatype representing a Bezier curve of degree \(n\) in \(d\)-dimensional space.
BezierSpline (LSeq (1 + n) (Point d r)) |
Instances
controlPoints :: Iso (BezierSpline n1 d1 r1) (BezierSpline n2 d2 r2) (LSeq (1 + n1) (Point d1 r1)) (LSeq (1 + n2) (Point d2 r2)) Source #
Bezier control points. With n degrees, there are n+1 control points.
fromPointSeq :: Seq (Point d r) -> BezierSpline n d r Source #
Constructs the Bezier Spline from a given sequence of points.
evaluate :: (Arity d, Ord r, Num r) => BezierSpline n d r -> r -> Point d r Source #
Evaluate a BezierSpline curve at time t in [0, 1]
pre: \(t \in [0,1]\)
split :: forall n d r. (KnownNat n, Arity d, Ord r, Num r) => r -> BezierSpline n d r -> (BezierSpline n d r, BezierSpline n d r) Source #
Split a Bezier curve at time t in [0, 1] into two pieces.
subBezier :: (KnownNat n, Arity d, Ord r, Num r) => r -> r -> BezierSpline n d r -> BezierSpline n d r Source #
Restrict a Bezier curve to th,e piece between parameters t < u in [0, 1].
tangent :: (Arity d, Num r, 1 <= n) => BezierSpline n d r -> Vector d r Source #
Tangent to the bezier spline at the starting point.
approximate :: forall n d r. (KnownNat n, Arity d, Ord r, Fractional r) => r -> BezierSpline n d r -> [Point d r] Source #
Approximate Bezier curve by Polyline with given resolution.
parameterOf :: (Arity d, Ord r, Fractional r) => BezierSpline n d r -> Point d r -> r Source #
Given a point on (or close to) a Bezier curve, return the corresponding parameter value. (For points far away from the curve, the function will return the parameter value of an approximate locally closest point to the input point.)
snap :: (Arity d, Ord r, Fractional r) => BezierSpline n d r -> Point d r -> Point d r Source #
Snap a point close to a Bezier curve to the curve.