Name : perl-Math-Bezier
| |
Version : 0.01
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp155.8.1
| Date : 2023-07-20 17:31:03
|
Group : Development/Libraries/Perl
| Source RPM : perl-Math-Bezier-0.01-lp155.8.1.src.rpm
|
Size : 0.01 MB
| |
Packager : https://www_suse_com/
| |
Summary : Solution of Bezier Curves
|
Description :
This module implements the algorithm for the solution of Bezier curves as presented by Robert D. Miller in Graphics Gems V, \"Quick and Simple Bezier Curve Drawing\".
A new Bezier curve is created using the new() constructor, passing a list of (x, y) control points.
use Math::Bezier;
my AATTcontrol = ( 0, 0, 10, 20, 30, -20, 40, 0 ); my $bezier = Math::Bezier->new(AATTcontrol);
Alternately, a reference to a list of control points may be passed.
my $bezier = Math::Bezier->new(\\AATTcontrol);
The point($theta) method can then be called on the object, passing a value in the range 0 to 1 which represents the distance along the curve. When called in list context, the method returns the x and y coordinates of that point on the Bezier curve.
my ($x, $y) = $bezier->point(0.5); print \"x: $x y: $y\
When called in scalar context, it returns a reference to a list containing the x and y coordinates.
my $point = $bezier->point(0.5); print \"x: $point->[0] y: $point->[1]\ \";
The curve($n) method can be used to return a set of points sampled along the length of the curve (i.e. in the range 0 < = $theta < = 1). The parameter indicates the number of sample points required, defaulting to 20 if undefined. The method returns a list of ($x1, $y1, $x2, $y2, ..., $xn, $yn) points when called in list context, or a reference to such an array when called in scalar context.
my AATTpoints = $bezier->curve(10);
while (AATTpoints) { my ($x, $y) = splice(AATTpoints, 0, 2); print \"x: $x y: $y\ \"; }
my $points = $bezier->curve(10);
while (AATT$points) { my ($x, $y) = splice(AATT$points, 0, 2); print \"x: $x y: $y\ \"; }
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-M/15.5/noarch |