Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

math::polygon::clip(3pm) [debian man page]

Math::Polygon::Clip(3pm)				User Contributed Perl Documentation				  Math::Polygon::Clip(3pm)

NAME
Math::Polygon::Clip - frame a polygon in a square INHERITANCE
Math::Polygon::Clip is a Exporter SYNOPSIS
my @poly = ( [1,2], [2,4], [5,7], [1, 2] ); my @box = ( $xmin, $ymin, $xmax, $ymax ); my $boxed = polygon_clip @box, @poly; DESCRIPTION
Cut-off all parts of the polygon which are outside the box FUNCTIONS
polygon_fill_clip1(ARRAY-BOX, LIST-OF-POINTS) Clipping a polygon into rectangles can be done in various ways. With this algorithm (which I designed myself, but may not be new), the parts of the polygon which are outside the BOX are mapped on the borders. The polygon stays in one piece. Returned is one list of points, which is cleaned from double points, spikes and superfluous intermediate points. polygon_fill_clip2(ARRAY-BOX, LIST-OF-POINTS) To be implemented. The polygon falls apart in fragments, which are not connected: paths which are followed in two directions are removed. This is required by some applications, like polygons used in geographical context (country contours and such). polygon_fill_clip3(ARRAY-BOX, OUT-POLY, [IN-POLYS]) To be implemented. A surrounding polygon, with possible inclussions. polygon_line_clip(ARRAY-BOX, LIST-OF-POINTS) Returned is a list of ARRAYS (possibly 0 long) containing line pieces from the input polygon (or line). example: my @points = ( [1,2], [2,3], [2,0], [1,-1], [1,2] ); my @bbox = ( 0, -2, 2, 2 ); my @l = polygon_line_clip @bbox, @points; print scalar @l; # 1, only one piece found my @first = @{$l[0]}; # first is [2,0], [1,-1], [1,2] SEE ALSO
This module is part of Math-Polygon distribution version 1.02, built on September 19, 2011. Website: http://perl.overmeer.net/geo/ 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 http://www.perl.com/perl/misc/Artistic.html perl v5.12.4 2011-09-19 Math::Polygon::Clip(3pm)

Check Out this Related Man Page

Math::Polygon::Transform(3pm)				User Contributed Perl Documentation			     Math::Polygon::Transform(3pm)

NAME
Math::Polygon::Transform - Polygon transformation INHERITANCE
Math::Polygon::Transform is a Exporter SYNOPSIS
my @poly = ( [1,2], [2,4], [5,7], [1, 2] ); my $area = polygon_transform resize => 3.14, @poly; DESCRIPTION
This package contains polygon transformation algorithms. FUNCTIONS
polygon_grid(OPTIONS, LIST-OF-POINTS) Snap the polygon points to grid points, where artifacts are removed. -Option--Default raster 1.0 raster => FLOAT The raster size, which determines the points to round to. The origin "[0,0]" is always on a grid-point. When the raster value is zero, no transformation will take place. 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 "rc" to describe a line. line => [POINT, POINT] Alternative way to specify the mirror line. The "rc" and "b" are 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 "rc" equals "-dy/dx", the firing angle. If "undef" is explicitly specified then "b" is used as constant x: it's a vertical mirror. x => FLOAT Mirror in the line "x=value", which means that "y" stays unchanged. y => FLOAT Mirror in the line "y=value", which means that "x" stays unchanged. polygon_move(OPTIONS, LIST-OF-POINTS) Returns a list of points which are moved over the indicated distance -Option--Default dx 0 dy 0 dx => FLOAT Displacement in the horizontal direction. dy => FLOAT Displacement in the vertical direction. 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 center => POINT degrees => FLOAT specify rotation angle in degrees (between -180 and 360). radians => FLOAT specify rotation angle in rads (between -pi and 2*pi) polygon_simplify(OPTIONS, LIST-OF-POINTS) -Option --Default max_points undef same 0.0001 slope undef max_points => INTEGER First, "same" and "slope" 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. 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 "slope" 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. DIAGNOSTICS
Error: you need to specify 'x', 'y', 'rc', or 'line' SEE ALSO
This module is part of Math-Polygon distribution version 1.02, built on September 19, 2011. Website: http://perl.overmeer.net/geo/ 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 http://www.perl.com/perl/misc/Artistic.html perl v5.12.4 2011-09-19 Math::Polygon::Transform(3pm)
Man Page