Seminar 3 - Curves
This time your task is to implement 3 methods for representing and rendering curves. In all the cases you will need to "split" the curves to N segments to render them. Then you can sample the curve in a specific time to obtain the desired points.
The related material is in lecture 7 about curves in computer graphics.
1) Hermite
Here you will need to implement 2 functions - solve_hermite and hermite.
Function solve_hermite is responsible for sampling curve's parameter domain by several numbers (values of the parameter) and calling the hermite function for each of them.
To obtain a point on the curve in a given "time" you need to implement the hermite function. This function computes the curve using Hermite interpolation method.
2) De Casteljau
You are again asked to finish 2 functions - solve_de_casteljau and de_casteljau.
The function solve_de_casteljau samples the curve to find the points on the curve for the given number of steps.
To find a point on the curve, you have to implement the de_casteljau recursive function.
Here is a nice visual interactive demonstration of how the algorithm works for four points.
3) De Boor
Here the implementation is split into 3 methods - solve_de_boor, de_boor and findKnotSpan.
The functions solve_de_boor and de_boor works similarly to De Casteljau. The difference is that we use De Boor's algorithm to find a point on the curve. We also need to find the knot span in the solve_de_boor function first to call the de_boor function.
findKnotSpan function is responsible for finding an index of an element in the knot vector U. Refer to the lecture slides.