Geomet...olygon(3pm)
π Geometry::Primitive::Polygon(3pm) π
okay bestie, welcome to the group chat. this page lives in the User Contributed Perl Documentation corner of your manual, and it's about Geometry::Primitive::Polygon. yes that's the whole title, yes it's a mouthful, we move. π«Ά
β¨ NAME β¨
Geometry::Primitive::Polygon β a closed shape with an arbitrary number of points. literally any number. go off. π
πΈ DESCRIPTION πΈ
So Geometry::Primitive::Polygon represents a two dimensional figure that's bounded by a series of points, and those points represent a closed path. that's it, that's the vibe. it's giving "connect the dots but make it geometry". β¨
π SYNOPSIS π
here's how you actually use it, no cap:
use Geometry::Primitive::Polygon;
my $poly = Geometry::Primitive::Polygon->new;
$poly->add_point($point1);
$poly->add_point($point2);
$poly->add_point($point3);
# No need to close the path, it's handled automatically
the way that last comment is doing all the work for you π β no need to close the path, it's handled automatically. you just keep dropping points and the module handles the rest. iconic behaviour honestly. π
π¦ ATTRIBUTES π¦
points
Set/Get the arrayref of points that make up this Polygon. that's the whole roster of points, babes. β
π METHODS π
new
Creates a new Geometry::Primitive::Polygon. fresh out the box, zero points, main character energy. π
area
Area of this polygon. quick heads up though β it assumes it is non-self-intersecting. so if your polygon is out here crossing its own lines like it's in a situationship, this number is not gonna be the truth. π
add_point
Add a point to this polygon. one at a time, bestie, build that shape up. β¨
clear_points
Clears all points from this polygon. factory reset, but make it geometric. π
point_count
Returns the number of points that bound this polygon. so you know exactly how many little guys are holding your shape together. π
get_point
Returns the point at the specified offset. you ask for one, you get one. π«Ά
point_end
Get the end point. Provided for Shape role. π
point_start
Get the start point. Provided for Shape role. β
scale ($amount)
Scale this this polygon by the supplied amount. (yes the original says "this this", we are keeping it exactly as written, fr fr π) so you hand it an $amount and your polygon gets bigger or smaller accordingly. π₯
πΈ AUTHOR πΈ
Cory Watson <gphat@cpan.org> β thank you for your service king π«‘π
π COPYRIGHT & LICENSE π
You can redistribute and/or modify this code under the same terms as Perl itself. slay, go forth, remix responsibly. π
and that's a wrap bestie!! this page came to you from perl v5.36.0, dated 2022-12-12 β no cap, that's the version and the date right there in the footer, we just folded it into the outro instead. bye bye, go draw some polygons πβ¨π¦
π¦ where this page comes from
- debian bookworm: libgeometry-primitive-perl 0.24-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libgeometry-primitive-perl 0.24-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgeometry-primitive-perl 0.24-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgeometry-primitive-perl 0.24-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgeometry-primitive-perl 0.24-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms