Name

getPt( ) — get a vertex of a polygon

Synopsis

GD::Polygon::getPt(index)

This method will return a list with the x, ycoordinate of the given point of a polygon object. The first point added to a polygon has an index of 0, the second has an index of 1, and so on. If a point is removed from somewhere in the middle of the list with deletePt( ), all points added after the removed point will have their indices decremented by 1. The method returns undef if the point does not exist.

# Retrieve the fourth point to be added to the polygon 
my ($x, $y) = $polywolly->getPt(3);

Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.