And then the excrement hit the fan, because after that perfectly straightforward rewrite, tests started failing left and right, with really weird errors. It took me about a half hour to figure out that this wasn't some strange Rakudo issue, it was a basic failure of my algorithm. For several weeks now, the code had been broken. But my tests were too clumsy to detect the failures until I stretched what I was doing really far out there.
Basically, the testing issue was this. The basis vector for the very first point of the NUBS curve should look like
(1 0 0 0 ...). That means the very first point is just the very first control point. However, if in all your tests that first control point is some variant of
(0, 0, 0, ...)(ie the origin), then a result of
(0, 0, 0, ...)for the first point only shows you that the basis vector looks like
(x 0 0 0 ...), where
xcan be anything at all. Whoops.
So it's back to the drawing board. Clearly I need more tests, and then I need to puzzle out where my algorithms have gone wrong. At least I'm pretty confident that I've got the Perl 6 issues worked out; now it's just a matter of fixing the math.