Math::Polygon::Transform - Polygon transformation
Math::Polygon::Transform is a Exporter
my @poly = ( [1,2], [2,4], [5,7], [1, 2] ); my $area = polygon_transform resize => 3.14, @poly;
This package contains polygon transformation algorithms.
- polygon_grid(%options, LIST-of-$points)
Snap the polygon points to grid points, where artifacts are removed.
-Option--Default raster 1.0
- polygon_mirror(%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 <undef> rc undef x undef y undef
- b => FLOAT
Only used in combination with option
rcto describe a line.
- line => [POINT, POINT]
Alternative way to specify the mirror line. The
bare computed from the two points of the line.
- rc => FLOAT
Description of the line which is used to mirror in. The line is
y= rc*x+b. The
-dy/dx, the firing angle. If
undefis explicitly specified then
bis used as constant x: it's a vertical mirror.
- x => FLOAT
Mirror in the line
x=value, which means that
- y => FLOAT
Mirror in the line
y=value, which means that
- polygon_move(%options, LIST-of-$points)
Returns a list of points which are moved over the indicated distance
-Option--Default dx 0 dy 0
- polygon_resize(%options, LIST-of-$points)
-Option--Default center [0,0] scale 1.0 xscale <scale> yscale <scale>
- center => POINT
- 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.
- xscale => FLOAT
Specific scaling factor in the horizontal direction.
- yscale => FLOAT
Specific scaling factor in the vertical direction.
- polygon_rotate(%options, LIST-of-$points)
-Option --Default center [0,0] degrees 0 radians 0
- polygon_simplify(%options, LIST-of-$points)
-Option --Default max_points undef same 0.0001 slope undef
- max_points => INTEGER
slopereduce 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.
- same => FLOAT
The distance between two points to be considered "the same" point. The value is used as radius of the circle.
- 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
slopelonger 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.
This module is part of Math-Polygon distribution version 1.05, built on December 28, 2016. Website: http://perl.overmeer.net/geo/
Copyrights 2004,2006-2016 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 http://www.perl.com/perl/misc/Artistic.html