M-File Help: Polygon View code for Polygon

Polygon

- General polygon class

p = plot Plot polygon area Area of polygon moments Moments of polygon centroid Centroid of polygon perimeter Perimter of polygon transform Transform polygon inside Test if points are inside polygon intersection Intersection of two polygons difference Difference of two polygons union Union of two polygons xor Exclusive or of two polygons display print the polygon in human readable form char convert the polgyon to human readable string

Properties

vertices List of polygon vertices, one per column
extent Bounding box [minx maxx; miny maxy]
n Number of vertices

Notes

Acknowledgement

The methods inside, intersection, difference, union, and xor are based on code written by: Kirill K. Pankratov, kirill@plume.mit.edu, http://puddle.mit.edu/~glenn/kirill/saga.html and require a licence. However the author does not respond to email regarding the licence, so use with care.

Polygon.Polygon

Polygon class constructor

p = Polygon(C, wh) is a rectangle centred at C with dimensions wh=[WIDTH, HEIGHT].

Polygon.area

Area of polygon

a = P.area of the polygon.

Polygon.centroid

Centroid of polygon

x = P.centroid of the polygon.

Polygon.char

String representation

s = P.

Polygon.difference

Difference of polygons

d = P.

Polygon.display

Display polygon

P.Polygon.char


Polygon.inside

Test if points are inside polygon

in = p.inside the polygon. The corresponding elements of in are either true or false.

Polygon.intersect

Intersection of polygon with list of polygons

i = P.Polygon P intersects with

Polygon.intersect_line

Intersection of polygon and line segment

i = P.

Polygon.intersection

Intersection of polygons

i = P.Polygon representing the

Polygon.moments

Moments of polygon

a = P.mpq_poly


Polygon.perimeter

Perimeter of polygon

L = P.perimeter of the polygon.

Polygon.plot

Plot polygon

P.plot the polygon. P.plot.

Polygon.transform

Transformation of polygon vertices

p2 = P.Polygon object whose vertices have been transfored by the 3x3 homgoeneous transformation T.

Polygon.union

Union of polygons

i = P.Polygon representing the

Polygon.xor

Exclusive or of polygons

i = P.Polygon representing the
 

© 1990-2011 Peter Corke.