1234567891011121314151617181920212223 ### Compute a point on power basis curve### The NURBS book p. 7use parent 'algorithm';sub new { my $class = shift; $self = SUPER::new->(@_);}sub calculate { my ($self, @a, $n, $u0, $C) = @_; $C = @a[$n]; for (my $i = $n - 1; $i >= 0; $i--) { $C = $C * $u0 + @a[$i]; } return $C;}
### Compute a point on power basis curve
### The NURBS book p. 7
use
parent
'algorithm'
;
sub
new {
my
$class
=
shift
$self
= SUPER::new->(
@_
);
}
calculate {
(
,
@a
$n
$u0
$C
) =
[
];
for
$i
- 1;
>= 0;
--) {
*
+
return