Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add Nubs.MakePolynomial.

  • Loading branch information...
commit f667cc173a77a7b315f2a8b2e0a31d3fe2f7843d 1 parent 8689930
SF authored
Showing with 22 additions and 1 deletion.
  1. +22 −1 lib/Nurbs.pm
View
23 lib/Nurbs.pm
@@ -1,6 +1,7 @@
use v6;
use KnotVector;
use Vector;
+use Polynomial;
class Nubs
{
@@ -18,9 +19,29 @@ class Nubs
self.WHAT.perl ~ ".new($.degree, {$.knot_vector.perl}, {@.control_points.perl})";
}
- method Evaluate($t)
+ multi method Evaluate($t)
{
my @N = $.knot_vector.N($.degree, $t);
return [+] (@N >>*<< @.control_points);
}
+
+ # multi method Evaluate($t)
+ # {
+ # say "Nubs.Evaluate";
+ # my $n0 = $.knot_vector.N0_index($t);
+ # say $n0;
+ # say $.knot_vector.N(1, $t).perl;
+ # say ($.knot_vector.N_local($n0, $.degree, $t)).perl;
+ # say (@.control_points[($n0 - ($.degree + 1)) .. ($n0 - 1)]).perl;
+ # return [+] ($.knot_vector.N_local($n0, $.degree, $t)
+ # >>*<< @.control_points[($n0 - ($.degree + 1)) .. ($n0 - 1)]);
+ # }
+
+
+ multi method MakePolynomial($t)
+ {
+ my $n0 = $.knot_vector.N0_index($.degree, $t);
+ return [+] ($.knot_vector.N_local($n0, $.degree, Polynomial.new(0, 1))
+ >>*<< @.control_points[$n0 .. ($n0 + $.degree)]);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.