splines icon indicating copy to clipboard operation
splines copied to clipboard

Scalar constraints in NURBS

Open fryguybob opened this issue 12 years ago • 1 comments

You could avoid the Scalar v ~ Scalar (Scalar v) constraints by having a type below BSpline that takes the scalar type as a parameter. Something like:

data BSpline' v t s = Spline
    { degree        :: !Int
    , knotVector    :: Knots s
    , controlPoints :: v t
    }

type BSpline v t = BSpline' v t (Scalar t)

newtype NURBS v = NURBS (BSpline' V.Vector (Scalar v, v) (Scalar v))

fryguybob avatar Jun 08 '13 01:06 fryguybob

I don't think I have time to look too closely at this right now, but I like the idea. One additional suggestion would be to insert the 'source' parameter as the second one, so 'BSpline v' would be a somewhat arrow-like type. I'm not sure if there are any nice properties that it would satisfy, but if it happened to it would be more likely to fit into the relevant type class that way.

mokus0 avatar Jun 09 '13 22:06 mokus0