.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Math::Polygon::Transform 3pm" .TH Math::Polygon::Transform 3pm "2022-10-13" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::Polygon::Transform \- Polygon transformation .SH "INHERITANCE" .IX Header "INHERITANCE" .Vb 2 \& Math::Polygon::Transform \& is a Exporter .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& my @poly = ( [1,2], [2,4], [5,7], [1, 2] ); \& \& my $area = polygon_transform resize => 3.14, @poly; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This package contains polygon transformation algorithms. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .ie n .IP "\fBpolygon_grid\fR(%options, @points)" 4 .el .IP "\fBpolygon_grid\fR(%options, \f(CW@points\fR)" 4 .IX Item "polygon_grid(%options, @points)" Snap the polygon points to grid points, where artifacts are removed. .Sp .Vb 2 \& \-Option\-\-Default \& raster 1.0 .Ve .RS 4 .IP "raster => \s-1FLOAT\s0" 2 .IX Item "raster => FLOAT" The raster size, which determines the points to round to. The origin \&\f(CW\*(C`[0,0]\*(C'\fR is always on a grid-point. When the raster value is zero, no transformation will take place. .RE .RS 4 .RE .ie n .IP "\fBpolygon_mirror\fR(%options, @points)" 4 .el .IP "\fBpolygon_mirror\fR(%options, \f(CW@points\fR)" 4 .IX Item "polygon_mirror(%options, @points)" Mirror the polygon in a line. Only one of the options can be provided. Some programs call this \*(L"flip\*(R" or \*(L"flop\*(R". .Sp .Vb 6 \& \-Option\-\-Default \& b 0 \& line \& rc undef \& x undef \& y undef .Ve .RS 4 .IP "b => \s-1FLOAT\s0" 2 .IX Item "b => FLOAT" Only used in combination with option \f(CW\*(C`rc\*(C'\fR to describe a line. .IP "line => [\s-1POINT, POINT\s0]" 2 .IX Item "line => [POINT, POINT]" Alternative way to specify the mirror line. The \f(CW\*(C`rc\*(C'\fR and \f(CW\*(C`b\*(C'\fR are computed from the two points of the line. .IP "rc => \s-1FLOAT\s0" 2 .IX Item "rc => FLOAT" Description of the line which is used to mirror in. The line is \&\f(CW\*(C`y= rc*x+b\*(C'\fR. The \f(CW\*(C`rc\*(C'\fR equals \f(CW\*(C`\-dy/dx\*(C'\fR, the firing angle. If \&\f(CW\*(C`undef\*(C'\fR is explicitly specified then \f(CW\*(C`b\*(C'\fR is used as constant x: it's a vertical mirror. .IP "x => \s-1FLOAT\s0" 2 .IX Item "x => FLOAT" Mirror in the line \f(CW\*(C`x=value\*(C'\fR, which means that \f(CW\*(C`y\*(C'\fR stays unchanged. .IP "y => \s-1FLOAT\s0" 2 .IX Item "y => FLOAT" Mirror in the line \f(CW\*(C`y=value\*(C'\fR, which means that \f(CW\*(C`x\*(C'\fR stays unchanged. .RE .RS 4 .RE .ie n .IP "\fBpolygon_move\fR(%options, @points)" 4 .el .IP "\fBpolygon_move\fR(%options, \f(CW@points\fR)" 4 .IX Item "polygon_move(%options, @points)" Returns a list of points which are moved over the indicated distance .Sp .Vb 3 \& \-Option\-\-Default \& dx 0 \& dy 0 .Ve .RS 4 .IP "dx => \s-1FLOAT\s0" 2 .IX Item "dx => FLOAT" Displacement in the horizontal direction. .IP "dy => \s-1FLOAT\s0" 2 .IX Item "dy => FLOAT" Displacement in the vertical direction. .RE .RS 4 .RE .ie n .IP "\fBpolygon_resize\fR(%options, @points)" 4 .el .IP "\fBpolygon_resize\fR(%options, \f(CW@points\fR)" 4 .IX Item "polygon_resize(%options, @points)" .Vb 5 \& \-Option\-\-Default \& center [0,0] \& scale 1.0 \& xscale \& yscale .Ve .RS 4 .IP "center => \s-1POINT\s0" 2 .IX Item "center => POINT" .PD 0 .IP "scale => \s-1FLOAT\s0" 2 .IX Item "scale => FLOAT" .PD 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. .IP "xscale => \s-1FLOAT\s0" 2 .IX Item "xscale => FLOAT" Specific scaling factor in the horizontal direction. .IP "yscale => \s-1FLOAT\s0" 2 .IX Item "yscale => FLOAT" Specific scaling factor in the vertical direction. .RE .RS 4 .RE .ie n .IP "\fBpolygon_rotate\fR(%options, @points)" 4 .el .IP "\fBpolygon_rotate\fR(%options, \f(CW@points\fR)" 4 .IX Item "polygon_rotate(%options, @points)" .Vb 4 \& \-Option \-\-Default \& center [0,0] \& degrees 0 \& radians 0 .Ve .RS 4 .IP "center => \s-1POINT\s0" 2 .IX Item "center => POINT" .PD 0 .IP "degrees => \s-1FLOAT\s0" 2 .IX Item "degrees => FLOAT" .PD specify rotation angle in degrees (between \-180 and 360). .IP "radians => \s-1FLOAT\s0" 2 .IX Item "radians => FLOAT" specify rotation angle in rads (between \-pi and 2*pi) .RE .RS 4 .RE .ie n .IP "\fBpolygon_simplify\fR(%options, @points)" 4 .el .IP "\fBpolygon_simplify\fR(%options, \f(CW@points\fR)" 4 .IX Item "polygon_simplify(%options, @points)" .Vb 4 \& \-Option \-\-Default \& max_points undef \& same 0.0001 \& slope undef .Ve .RS 4 .IP "max_points => \s-1INTEGER\s0" 2 .IX Item "max_points => INTEGER" First, \f(CW\*(C`same\*(C'\fR and \f(CW\*(C`slope\*(C'\fR 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. .IP "same => \s-1FLOAT\s0" 2 .IX Item "same => FLOAT" The distance between two points to be considered \*(L"the same\*(R" point. The value is used as radius of the circle. .IP "slope => \s-1FLOAT\s0" 2 .IX 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 \f(CW\*(C`slope\*(C'\fR longer than the direct path between X(n) and X(n+2). .Sp The slope will not be removed around the starting point of the polygon. Removing points will change the area of the polygon. .RE .RS 4 .RE .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" .IP "Error: you need to specify 'x', 'y', 'rc', or 'line'" 4 .IX Item "Error: you need to specify 'x', 'y', 'rc', or 'line'" .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of Math-Polygon distribution version 1.10, built on January 03, 2018. Website: \fIhttp://perl.overmeer.net/CPAN/\fR .SH "LICENSE" .IX Header "LICENSE" Copyrights 2004\-2018 by [Mark Overmeer]. For other contributors see ChangeLog. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See \fIhttp://dev.perl.org/licenses/\fR