Nubs.evaluate. I'm going to repeat that code here, as I've added one of the
Nubs.evaluatefunctions to the mix.
These functions became overly complex because I tried to overload the KnotBasisDirection enum with an extra layer of meaning. Pulling that extra layer out and rearranging things a tad gives you vastly better code:
Notice that we've eliminated an enum value here, two cases that needed to be checked for, and simplified a third line of code. The "trick" (almost too obvious to be called a trick) is to make the default value of
$directionbe determined by a called to
Direction, rather than calling Direction with a special value that indicates it needs to do work.
It's the best of both worlds. By default, if you don't specify
$directionit will do something reasonable. And for those rare weird cases where it is important (discontinuities in the curve), you can specify the direction to use for the evaluation.
Tomorrow: On the road to SVG in Perl 6.