Created
November 3, 2009 08:26
-
-
Save LastOfTheCarelessMen/224897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multi method KnotVector.N0_index(Int $p, $u, KnotBasisDirection $direction = Left) | |
{ | |
given $direction | |
{ | |
when Left { UpperBound(@.knots, $u) - $p - 1; } | |
when Right { LowerBound(@.knots, $u) - $p - 1; } | |
} | |
} | |
multi method Nubs.Direction($t) | |
{ | |
$t < ([+] self.ParameterRange) / 2 ?? Left !! Right; | |
} | |
multi method Nubs.evaluate($t, KnotBasisDirection $direction = self.Direction($t)) | |
{ | |
my $n0 = $.knot_vector.N0_index($.degree, $t, $direction); | |
return [+] ($.knot_vector.N_local($n0, $.degree, $t) | |
>>*<< @.control_points[$n0 .. ($n0 + $.degree)]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment