Hi Chriss,
it really makes fun to work with FFD! I looked at your code and found the factorial function where you mentioned to encrease performance by adding a table for factorials. I made it dynamic and it boosts your code! Just replace the section with:
#used by calcBernstein. could be replaced by a table since in
#this application n is never more than 3 (number of control points).
$fTable = []
def factorial(n)
sum = $fTable.rassoc(n)
if sum
return sum[0]
else
sum = 1
sum.upto(n) { |i| sum *= i }
$fTable << [sum, n]
return sum
end
end
Ciao, Stefan