1Math::Polygon::Surface(U3s)er Contributed Perl DocumentatMiaotnh::Polygon::Surface(3)
2
3
4

NAME

6       Math::Polygon::Surface - Polygon with exclusions
7

SYNOPSIS

9        my $outer   = Math::Polygon->new( [1,2], [2,4], [5,7], [1,2] );
10        my $surface = Math::Polygon::Surface->new($outer);
11

DESCRIPTION

13       A surface is one polygon which represents the outer bounds of an array,
14       plus optionally a list of polygons which represent exclusions from that
15       outer polygon.
16

METHODS

18   Constructors
19       $obj->new( [%options], [@polygons], %options )
20       Math::Polygon::Surface->new( [%options], [@polygons], %options )
21           You may merge %options with @polygons.  You may also use the
22           "outer" and "inner" options.
23
24           Each polygon is a references to an ARRAY of points, each an ARRAY
25           of X and Y, but better pass Math::Polygon objects.
26
27            -Option--Default
28             inner   []
29             outer   undef
30
31           inner => \@polygons
32             The inner polygons, zero or more Math::Polygon objects.
33
34           outer => $polygon
35             The outer polygon, a Math::Polygon.
36
37   Attributes
38       $obj->inner()
39           Returns a list (often empty) of inner polygons.
40
41       $obj->outer()
42           Returns the outer polygon.
43
44   Simple calculations
45       area()
46           Returns the area enclosed by the outer polygon, minus the areas of
47           the inner polygons.  See method Math::Polygon::area().
48
49       $obj->bbox()
50           Returns a list with four elements: (xmin, ymin, xmax, ymax), which
51           describe the bounding box of the surface, which is the bbox of the
52           outer polygon.  See method Math::Polygon::bbox().
53
54       $obj->perimeter()
55           The length of the border: sums outer and inner perimeters.  See
56           method Math::Polygon::perimeter().
57
58   Clipping
59       $obj->fillClip1($box)
60           Clipping a polygon into rectangles can be done in various ways.
61           With this algorithm, the parts of the polygon which are outside the
62           $box are mapped on the borders.
63
64           All polygons are treated separately.
65
66       $obj->lineClip($box)
67           Returned is a list of ARRAYS-OF-POINTS containing line pieces from
68           the input surface.  Lines from outer and inner polygons are
69           undistinguishable.  See method Math::Polygon::lineClip().
70
71       $obj->string()
72           Translate the surface structure into some string.  Use Geo::WKT if
73           you need a standardized format.
74
75           Returned is a single string possibly containing multiple lines.
76           The first line is the outer, the other lines represent the inner
77           polygons.
78

DIAGNOSTICS

80       Error: surface requires outer polygon
81

SEE ALSO

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

LICENSE

87       Copyrights 2004-2018 by [Mark Overmeer]. For other contributors see
88       ChangeLog.
89
90       This program is free software; you can redistribute it and/or modify it
91       under the same terms as Perl itself.  See http://dev.perl.org/licenses/
92
93
94
95perl v5.32.0                      2020-07-28         Math::Polygon::Surface(3)
Impressum