Oblig 1- hints for the implementation

Note that the implementation of Neville-Aitken and deCastaljau is done using for-loops as indicated by the descriptions of the algorithms - use the same indexing in the for loops. But: if you use a programming language where vector indices start with 1 (e.g. matlab) you need to offset reads and writes wrt the vector with 1. E.g. for deCasteljau, something like (the vector q holds the coefficients, p+1 one of them before the first round of averaging) 

q(j+1) = (1 ? t)*q(j-1+1) + t*q(j+1

Do NOT use matrices for the implementation (unless you see the vector of control points in the plane as a 2x(p+1) matrix). You should be able to "overwrite" the elements of a vector containing coefficients, either starting with the first or the last element so that you do not overwrite data that is used in a later calculation ;)

Publisert 25. jan. 2017 13:50