nurbs-0.1.1.0: NURBS

Linear.NURBS

Synopsis

# Documentation

binomial :: Integral a => a -> a -> a Source

Binomial coefficients

size :: (Additive f, Floating a, Foldable f) => f a -> a Source

Size of vector

spanId :: (Ord a, Num a) => a -> Span a -> a Source

Piecewise constant function, returns 1 in span, 0 otherwise

spanEmpty :: Eq a => Span a -> Bool Source

Is span empty

spanLength :: Num a => Span a -> a Source

Span length

inSpan :: Ord a => a -> Span a -> Bool Source

Check whether value in span

grow :: (Ord a, Fractional a) => a -> Span a -> a Source

Grow within span from 0 to 1

fall :: (Ord a, Fractional a) => a -> Span a -> a Source

Fall function, opposite to `grow`

coords :: (Eq a, Fractional a) => Span a -> Iso' a a Source

Map value to span coordinates, span start mapped to 0, end to 1

rangeSpan :: [a] -> Span a Source

Make span from knot vector

mergeSpan :: Ord a => Span a -> Span a -> Span a Source

Merge spans

knotSpans :: Num a => Int -> [a] -> [Span a] Source

Generate knot spans of degree

growSpans :: Num a => Int -> [a] -> [Span a] Source

Generate drow spans of degree

fallSpans :: Num a => Int -> [a] -> [Span a] Source

Generate fall spans of degree

dataSpan :: (Eq a, Fractional a) => Lens' (KnotData a) (Span a) Source

Span of knot data

makeData :: (Ord a, Num a) => [a] -> a -> KnotData a Source

Make initial knot data

iterData :: (Ord a, Fractional a) => KnotData a -> KnotData a Source

Eval basis function for next degree

evalData :: (Ord a, Fractional a) => Int -> KnotData a -> KnotData a Source

Eval for n degree

basis :: (Ord a, Fractional a) => [a] -> Int -> Int -> a -> a Source

Nᵢ,ₙ — n-degree basis function for i-th control point

rbasis :: (Ord a, Fractional a) => [a] -> [a] -> Int -> Int -> a -> a Source

Rᵢ,ₙ — n-degree rational basis function for i-th control point

eval :: (Additive f, Ord a, Fractional a) => NURBS f a -> a -> f a Source

Evaluate nurbs point

uniformKnot :: Fractional a => Int -> Int -> [a] Source

Generate knot of degree for points

cycleKnot :: Fractional a => Int -> [a] Source

Generate cycle knot

periodic :: Fractional a => Lens' (NURBS f a) Bool Source

Is NURBS periodic

degree :: Fractional a => Lens' (NURBS f a) Int Source

NURBS degree

wpoints :: Fractional a => Lens (NURBS f a) (NURBS g a) [Weight f a] [Weight g a] Source

NURBS points with weights

points :: (Additive f, Additive g, Fractional a) => Traversal (NURBS f a) (NURBS g a) (f a) (g a) Source

NURBS points without weights

knotVector :: Eq a => Lens' (NURBS f a) [a] Source

NURBS knot vector

iknotVector :: (Eq a, Fractional a) => Lens' (NURBS f a) [a] Source

knotSpan :: (Eq a, Fractional a) => Lens' (NURBS f a) (Span a) Source

NURBS knot span

normalizeKnot :: (Eq a, Fractional a) => NURBS f a -> NURBS f a Source

Scale NURBS params to ∈ [0, 1]

nurbs :: (Additive f, Fractional a) => Int -> [f a] -> NURBS f a Source

Make nurbs of degree from points

wnurbs :: (Additive f, Fractional a) => Int -> [Weight f a] -> NURBS f a Source

Make nurbs of degree from weighted points

insertKnot :: (Additive f, Ord a, Fractional a) => a -> NURBS f a -> NURBS f a Source

Insert knot qᵢ₊₁ = fᵢ⋅pᵢ + (1-fᵢ)⋅pᵢ₊₁ q₀ = p₀ (f₋₁ ≡ 0) (non periodic nurbs) qₙ₊₁ = pₙ (fₙ ≡ 1) (non periodic nurbs) fᵢ, pᵢ, pᵢ₊₁ ↦ qᵢ₊₁

insertKnots :: (Additive f, Ord a, Fractional a) => [(Int, a)] -> NURBS f a -> NURBS f a Source

Insert knots

appendPoint :: (Eq a, Fractional a) => a -> Weight f a -> NURBS f a -> NURBS f a Source

Append point

prependPoint :: (Eq a, Fractional a) => a -> Weight f a -> NURBS f a -> NURBS f a Source

Prepend point

split :: (Additive f, Ord a, Fractional a) => a -> NURBS f a -> (NURBS f a, NURBS f a) Source

Split NURBS

cut :: (Additive f, Ord a, Fractional a) => Span a -> NURBS f a -> NURBS f a Source

Cut NURBS

breakLoop :: (Additive f, Ord a, Fractional a) => a -> NURBS f a -> NURBS f a Source

Break periodic NURBS at param

removeKnot :: (Foldable f, Additive f, Ord a, Floating a, SimEq (NURBS f a)) => a -> NURBS f a -> Maybe (NURBS f a) Source

Remove knot pᵢ₊₁ = (qᵢ₊₁ - fᵢ⋅pᵢ)(1-fᵢ) = hᵢ⋅qᵢ₊₁ + (1-hᵢ)⋅pᵢ, where hᵢ = 1(1-fᵢ) ∧ fᵢ ≢ 1 if fᵢ = 1 then pᵢ₊₁ = qᵢ₊₁ p₀ = q₀ (h₋₁ ≡ 1) pₙ = qₙ₊₁ (hₙ ≡ ∞, fₙ ≡ 1) hᵢ, qᵢ₊₁, pᵢ ↦ pᵢ₊₁

removeKnot_ :: (Foldable f, Additive f, Ord a, Floating a, SimEq (NURBS f a)) => a -> NURBS f a -> NURBS f a Source

Try remove knot

removeKnots :: (Foldable f, Additive f, Ord a, Floating a, SimEq (NURBS f a)) => [(Int, a)] -> NURBS f a -> NURBS f a Source

Remove knots

purgeKnot :: (Foldable f, Additive f, Ord a, Floating a, SimEq (NURBS f a)) => a -> NURBS f a -> NURBS f a Source

Try remove knot as much times as possible

purgeKnots :: (Foldable f, Additive f, Ord a, Floating a, SimEq (NURBS f a)) => NURBS f a -> NURBS f a Source

Try remove knots

ndist :: (Metric f, Ord a, Floating a) => f a -> f a -> a Source

Distance between points

class SimEq a where Source

Minimal complete definition

Nothing

Methods

(≃) :: a -> a -> Bool Source

(≄) :: a -> a -> Bool Source

Instances

 (Ord a, Floating a) => SimEq a Source (Metric f, Ord a, Floating a, SimEq a) => SimEq (f a) Source SimEq a => SimEq (Maybe a) Source (Metric f, Ord a, Floating a, SimEq a) => SimEq (Weight f a) Source (Metric f, Ord a, Floating a, SimEq (f a)) => SimEq (NURBS f a) Source

simEq :: SimEq a => a -> a -> Bool Source

simNeq :: SimEq a => a -> a -> Bool Source

joint :: (Ord a, Num a, Floating a, Foldable f, Metric f, SimEq (Weight f a), SimEq (NURBS f a)) => NURBS f a -> NURBS f a -> Maybe (NURBS f a) Source

Try to joint two NURBS

(⊕) :: (Ord a, Num a, Floating a, Foldable f, Metric f, SimEq (Weight f a), SimEq (NURBS f a)) => NURBS f a -> NURBS f a -> Maybe (NURBS f a) Source

Joint

pline :: (Additive f, Fractional a) => [f a] -> NURBS f a Source

Make pline NURBS

circle :: (Eq a, Floating a) => V2 a -> a -> NURBS V2 a Source

Make circle NURBS