Safe Haskell | None |
---|

- data Knots a
- empty :: Knots a
- isEmpty :: Knots a -> Bool
- knot :: Ord a => a -> Knots a
- multipleKnot :: Ord a => a -> Int -> Knots a
- mkKnots :: Ord a => [a] -> Knots a
- fromList :: Ord k => [(k, Int)] -> Knots k
- numKnots :: Knots t -> Int
- lookupKnot :: Int -> Knots a -> Maybe a
- toList :: Eq k => Knots k -> [(k, Int)]
- numDistinctKnots :: Eq t => Knots t -> Int
- lookupDistinctKnot :: Eq a => Int -> Knots a -> Maybe a
- knots :: Knots t -> [t]
- knotsVector :: Knots t -> Vector t
- distinctKnots :: Eq t => Knots t -> [t]
- multiplicities :: Eq t => Knots t -> [Int]
- distinctKnotsVector :: Eq t => Knots t -> Vector t
- multiplicitiesVector :: Eq a => Knots a -> Vector Int
- distinctKnotsSet :: Eq k => Knots k -> Set k
- toMap :: Ord k => Knots k -> Map k Int
- fromMap :: Eq k => Map k Int -> Knots k
- toVector :: Eq k => Knots k -> Vector (k, Int)
- fromVector :: Ord k => Vector (k, Int) -> Knots k
- splitLookup :: Int -> Knots a -> (Knots a, Maybe a, Knots a)
- takeKnots :: Int -> Knots a -> Knots a
- dropKnots :: Int -> Knots a -> Knots a
- splitKnotsAt :: Int -> Knots a -> (Knots a, Knots a)
- takeDistinctKnots :: Ord a => Int -> Knots a -> Knots a
- dropDistinctKnots :: Ord a => Int -> Knots a -> Knots a
- splitDistinctKnotsAt :: (Ord a, Eq a) => Int -> Knots a -> (Knots a, Knots a)
- maxMultiplicity :: Ord t => Knots t -> Int
- knotMultiplicity :: Ord k => k -> Knots k -> Int
- setKnotMultiplicity :: Ord k => k -> Int -> Knots k -> Knots k
- splitFind :: Ord k => k -> Knots k -> (Knots k, Knots k, Knots k)
- fromAscList :: Eq k => [(k, Int)] -> Knots k
- fromDistinctAscList :: Eq k => [(k, Int)] -> Knots k
- valid :: (Ord k, Num k) => Knots k -> Bool
- knotSpan :: Knots a -> Int -> Int -> Maybe (a, a)
- knotsInSpan :: Knots a -> Int -> Int -> Knots a
- knotSpans :: Knots a -> Int -> [(a, a)]
- knotDomain :: Knots a -> Int -> Maybe (a, a)
- uniform :: (Ord s, Fractional s) => Int -> Int -> (s, s) -> Knots s
- minKnot :: Eq a => Knots a -> Maybe (a, Int)
- maxKnot :: Eq a => Knots a -> Maybe (a, Int)

# Documentation

Knot vectors - multisets of points in a 1-dimensional space.

multipleKnot :: Ord a => a -> Int -> Knots aSource

Create a knot vector consisting of one knot with the specified multiplicity.

fromList :: Ord k => [(k, Int)] -> Knots kSource

Create a knot vector consisting of all the knots and corresponding multiplicities in a list.

numKnots :: Knots t -> IntSource

Returns the number of knots (not necessarily distinct) in a knot vector.

lookupKnot :: Int -> Knots a -> Maybe aSource

toList :: Eq k => Knots k -> [(k, Int)]Source

Returns a list of all distinct knots in ascending order along with their multiplicities.

numDistinctKnots :: Eq t => Knots t -> IntSource

Returns the number of distinct knots in a knot vector.

Returns a list of all knots (not necessarily distinct) of a knot vector in ascending order

knotsVector :: Knots t -> Vector tSource

Returns a vector of all knots (not necessarily distinct) of a knot vector in ascending order

distinctKnots :: Eq t => Knots t -> [t]Source

Returns a list of all distinct knots of a knot vector in ascending order

multiplicities :: Eq t => Knots t -> [Int]Source

distinctKnotsVector :: Eq t => Knots t -> Vector tSource

Returns a vector of all distinct knots of a knot vector in ascending order

distinctKnotsSet :: Eq k => Knots k -> Set kSource

Returns a `Set`

of all distinct knots of a knot vector

splitLookup :: Int -> Knots a -> (Knots a, Maybe a, Knots a)Source

`splitLookup n kts`

: Split a knot vector `kts`

into 3 parts `(pre, mbKt, post)`

such that:

- All the keys in
`pre`

,`mbKt`

(viewed as a knot vector of either 0 or 1 knot), and`post`

are disjoint and ordered * Putting the 3 parts back together yields exactly the original knot vector * The`n`

'th knot, if one exists, will be in`mbKt`

along with its multiplicity

maxMultiplicity :: Ord t => Knots t -> IntSource

knotMultiplicity :: Ord k => k -> Knots k -> IntSource

Looks up the multiplicity of a knot (which is 0 if the point is not a knot)

setKnotMultiplicity :: Ord k => k -> Int -> Knots k -> Knots kSource

Returns a new knot vector with the given knot set to the specified multiplicity and all other knots unchanged.

fromAscList :: Eq k => [(k, Int)] -> Knots kSource

Create a knot vector consisting of all the knots and corresponding
multiplicities in a list ordered by the knots' `Ord`

instance. The
ordering precondition is not checked.

fromDistinctAscList :: Eq k => [(k, Int)] -> Knots kSource

Create a knot vector consisting of all the knots and corresponding
multiplicities in a list ordered by the knots' `Ord`

instance with no
duplicates. The preconditions are not checked.

knotSpan :: Knots a -> Int -> Int -> Maybe (a, a)Source

`knotSpan kts i j`

returns the knot span extending from the `i`

'th knot
to the `j`

'th knot, if `i <= j`

and both knots exist.

knotsInSpan :: Knots a -> Int -> Int -> Knots aSource

`knotsInSpan kts i j`

returns the knots in the knot span extending from
the `i`

'th knot to the `j`

'th knot

knotSpans :: Knots a -> Int -> [(a, a)]Source

`knotSpans kts width`

returns all knot spans of a given width in
ascending order.

For example, `knotSpans (mkKnots [1..5]) 2`

yields `[(1,3), (2,4), (3,5)]`

.

knotDomain :: Knots a -> Int -> Maybe (a, a)Source

`knotDomain kts p`

returns the domain of a B-spline or NURBS with knot
vector `kts`

and degree `p`

. This is the subrange spanned by all
except the first and last `p`

knots. Outside this domain, the spline
does not have a complete basis set. De Boor's algorithm assumes that
the basis functions sum to 1, which is only true on this range, and so
this is also precisely the domain on which de Boor's algorithm is valid.