Geomet...olygon(3pm)

πŸ“¦
version 0.24 Β· 2 versions
  • 0.24 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.24 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 πŸ«‘πŸ’œ


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