1Math::Polygon::TransforUms(e3r)Contributed Perl DocumentMaattiho:n:Polygon::Transform(3)
2
3
4

NAME

6       Math::Polygon::Transform - Polygon transformation
7

INHERITANCE

9        Math::Polygon::Transform
10          is a Exporter
11

SYNOPSIS

13        my @poly = ( [1,2], [2,4], [5,7], [1, 2] );
14
15        my $area = polygon_transform resize => 3.14, @poly;
16

DESCRIPTION

18       This package contains polygon transformation algorithms.
19

FUNCTIONS

21       polygon_grid(%options, @points)
22           Snap the polygon points to grid points, where artifacts are
23           removed.
24
25            -Option--Default
26             raster  1.0
27
28           raster => FLOAT
29             The raster size, which determines the points to round to.  The
30             origin "[0,0]" is always on a grid-point.  When the raster value
31             is zero, no transformation will take place.
32
33       polygon_mirror(%options, @points)
34           Mirror the polygon in a line.  Only one of the options can be
35           provided.  Some programs call this "flip" or "flop".
36
37            -Option--Default
38             b       0
39             line    <undef>
40             rc      undef
41             x       undef
42             y       undef
43
44           b => FLOAT
45             Only used in combination with option "rc" to describe a line.
46
47           line => [POINT, POINT]
48             Alternative way to specify the mirror line.  The "rc" and "b" are
49             computed from the two points of the line.
50
51           rc => FLOAT
52             Description of the line which is used to mirror in. The line is
53             "y= rc*x+b".  The "rc" equals "-dy/dx", the firing angle.  If
54             "undef" is explicitly specified then "b" is used as constant x:
55             it's a vertical mirror.
56
57           x => FLOAT
58             Mirror in the line "x=value", which means that "y" stays
59             unchanged.
60
61           y => FLOAT
62             Mirror in the line "y=value", which means that "x" stays
63             unchanged.
64
65       polygon_move(%options, @points)
66           Returns a list of points which are moved over the indicated
67           distance
68
69            -Option--Default
70             dx      0
71             dy      0
72
73           dx => FLOAT
74             Displacement in the horizontal direction.
75
76           dy => FLOAT
77             Displacement in the vertical direction.
78
79       polygon_resize(%options, @points)
80            -Option--Default
81             center  [0,0]
82             scale   1.0
83             xscale  <scale>
84             yscale  <scale>
85
86           center => POINT
87           scale => FLOAT
88             Resize the polygon with the indicated factor.  When the factor is
89             larger than 1, the resulting polygon with grow, when small it
90             will be reduced in size.  The scale will be respective from the
91             center.
92
93           xscale => FLOAT
94             Specific scaling factor in the horizontal direction.
95
96           yscale => FLOAT
97             Specific scaling factor in the vertical direction.
98
99       polygon_rotate(%options, @points)
100            -Option --Default
101             center   [0,0]
102             degrees  0
103             radians  0
104
105           center => POINT
106           degrees => FLOAT
107             specify rotation angle in degrees (between -180 and 360).
108
109           radians => FLOAT
110             specify rotation angle in rads (between -pi and 2*pi)
111
112       polygon_simplify(%options, @points)
113            -Option    --Default
114             max_points  undef
115             same        0.0001
116             slope       undef
117
118           max_points => INTEGER
119             First, "same" and "slope" reduce the number of points.  Then, if
120             there are still more than the specified number of points left,
121             the points with the widest angles will be removed until the
122             specified maximum number is reached.
123
124           same => FLOAT
125             The distance between two points to be considered "the same"
126             point.  The value is used as radius of the circle.
127
128           slope => FLOAT
129             With three points X(n),X(n+1),X(n+2), the point X(n+1) will be
130             removed if the length of the path over all three points is less
131             than "slope" longer than the direct path between X(n) and X(n+2).
132
133             The slope will not be removed around the starting point of the
134             polygon.  Removing points will change the area of the polygon.
135

DIAGNOSTICS

137       Error: you need to specify 'x', 'y', 'rc', or 'line'
138

SEE ALSO

140       This module is part of Math-Polygon distribution version 1.10, built on
141       January 03, 2018. Website: http://perl.overmeer.net/CPAN/
142

LICENSE

144       Copyrights 2004-2018 by [Mark Overmeer]. For other contributors see
145       ChangeLog.
146
147       This program is free software; you can redistribute it and/or modify it
148       under the same terms as Perl itself.  See http://dev.perl.org/licenses/
149
150
151
152perl v5.36.0                      2023-01-20       Math::Polygon::Transform(3)
Impressum