=head1 NAME
Math::Polygon::Transform - Polygon transformation
=head1 INHERITANCE
Math::Polygon::Transform
is a Exporter
=head1 SYNOPSIS
my @poly = ( [1,2], [2,4], [5,7], [1, 2] );
my $area = polygon_transform resize => 3.14, @poly;
=head1 DESCRIPTION
This package contains polygon transformation algorithms.
=head1 FUNCTIONS
=over 4
=item B(OPTIONS, LIST-OF-POINTS)
Snap the polygon points to grid points, where artifacts are removed.
-Option--Default
raster 1.0
=over 2
=item raster => FLOAT
The raster size, which determines the points to round to. The origin
C<[0,0]> is always on a grid-point. When the raster value is zero,
no transformation will take place.
=back
=item B(OPTIONS, LIST-OF-POINTS)
Mirror the polygon in a line. Only one of the options can be provided.
Some programs call this "flip" or "flop".
-Option--Default
b 0
line
rc undef
x undef
y undef
=over 2
=item b => FLOAT
Only used in combination with option C to describe a line.
=item line => [POINT, POINT]
Alternative way to specify the mirror line. The C and C** are
computed from the two points of the line.
=item rc => FLOAT
Description of the line which is used to mirror in. The line is
C. The C equals C<-dy/dx>, the firing angle. If
C is explicitly specified then C**** is used as constant x: it's
a vertical mirror.
=item x => FLOAT
Mirror in the line C, which means that C stays unchanged.
=item y => FLOAT
Mirror in the line C, which means that C stays unchanged.
=back
=item B(OPTIONS, LIST-OF-POINTS)
Returns a list of points which are moved over the indicated distance
-Option--Default
dx 0
dy 0
=over 2
=item dx => FLOAT
Displacement in the horizontal direction.
=item dy => FLOAT
Displacement in the vertical direction.
=back
=item B(OPTIONS, LIST-OF-POINTS)
-Option--Default
center [0,0]
scale 1.0
xscale
yscale
=over 2
=item center => POINT
=item scale => FLOAT
Resize the polygon with the indicated factor. When the factor is larger
than 1, the resulting polygon with grow, when small it will be reduced in
size. The scale will be respective from the center.
=item xscale => FLOAT
Specific scaling factor in the horizontal direction.
=item yscale => FLOAT
Specific scaling factor in the vertical direction.
=back
=item B(OPTIONS, LIST-OF-POINTS)
-Option --Default
center [0,0]
degrees 0
radians 0
=over 2
=item center => POINT
=item degrees => FLOAT
specify rotation angle in degrees (between -180 and 360).
=item radians => FLOAT
specify rotation angle in rads (between -pi and 2*pi)
=back
=item B(OPTIONS, LIST-OF-POINTS)
-Option --Default
max_points undef
same 0.0001
slope undef
=over 2
=item max_points => INTEGER
First, C and C reduce the number of points. Then, if there
are still more than the specified number of points left, the points with
the widest angles will be removed until the specified maximum number is
reached.
=item same => FLOAT
The distance between two points to be considered "the same" point. The value
is used as radius of the circle.
=item slope => FLOAT
With three points X(n),X(n+1),X(n+2), the point X(n+1) will be removed if
the length of the path over all three points is less than C longer
than the direct path between X(n) and X(n+2).
The slope will not be removed around the starting point of the polygon.
Removing points will change the area of the polygon.
=back
=back
=head1 DIAGNOSTICS
=over 4
=item Error: you need to specify 'x', 'y', 'rc', or 'line'
=back
=head1 SEE ALSO
This module is part of Math-Polygon distribution version 1.02,
built on September 19, 2011. Website: F
=head1 LICENSE
Copyrights 2004,2006-2011 by Mark Overmeer. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F
**