<bezier-curve> ( control-points -- polynomials )


Vocabulary
math.splines

Inputs
control-pointssequence of control points same dimension


Outputs
polynomialssequence of polynomials for each dimension


Word description
Creates bezier curve polynomials for the given control points.

Definition


:: <bezier-curve> ( control-points -- polynomials )
control-points
[ length 1 - ] [ first length [ { 0 } ] replicate ] bi
:> ( n acc ) control-points [| pt i |
n i bernstein-polynomial-ith :> poly pt
[| v j | j acc [ v poly n*p p+ ] change-nth ] each-index
] each-index acc ;