[libgfc Index] [libgfc Hierarchy] [Headers]
The 2D polygon (with holes) ADT More...
#include <src/gadt_polygon.h>
Inherits: GSpatial
The 2D polygon (with holes) ADT.
A polygon is a bounded area defined by one or more rings. If there are more than one rings, then there is one outer boundary ring and the rest are interier rings (holes). The internal data layout is very similar to that of an ArcView shapefile Polygon record (without all the record headers etc).
The first ring is the outer boundary of the polygon by default.
[public virtual]
User format: "n_rings, #_points_1, #_points_2, ... #_points_N, x1 y1 x2 y2 ... xm ym"
[public virtual]
generates a string with same format in input
[public virtual]
compares the area with the polygon 'a's area. Returns -1 if 'a' has larger area; or zero if they equal; otherwise 1
[public virtual]
this method accepts severl "parts" each of which are a series of ordered points. All existing data will be replaced by the new data.
[public]
return number of rings
[public]
return 1 if the polygon has holes
[public]
add a ring to the owning polygon
coords | the coordinates of the new ring |
n_vertices | number of vertices in the new ring |
[public]
return the information about a particular ring
coords | where the coordinates of the ring begin |
nth | which ring to get |
[public]
set the MBR
[public]
recalculate the MBR for this polygon
r | is the newly calculated MBR |
[public]
return distance between this polygon and another object.
if the argument is another polygon, we calculte the distance between the centroids of the two polygons' outer boundary ring only... this may not really what we want since we don't take into account any of the holes of either polygon.
@Return the distance.
[public]
return the area (not including any holes)
[public]
calculate the signed area of a ring (simple polygon without holes).
n_points | number of vertices in the ring |
coord | coordinates of the vertices. Can be used to determine the ordering of vertices. |
[public]
calculate the signed area of a polygon (assuming a simple one). the area of holes are subtracted from that of the outer boundary ring.
[public]
return the perimeter (including those of the holes)
[public]
calculate the perimeter of a particular ring
nth | specifies the ring |
[public]
Determine the class of the polygon according to its convexity. It calls some inlines that are useful routines in their own right.
Originally by Peter Schorn & Frederick Fisher, In "Graphics Gems IV", Academic Press 1994.
[public]
handy version of the classify method.
[public]
return the centroid (of the outer boundary ring!)
[public]
calculate the centrod of a ring (simple polygon w/o holes).
[public virtual]
ADT-in-Polygon checking. It is a driver that calls sub-routines according to the given type. for now it's only accepting point ADT.
[public virtual]
check if this polygon intersects with other adt objects. calls subroutines accordingly with given type of adt.
[public virtual]
check if this polygon intersects with a linear series of connected coordinates.
[public virtual]
check if the polygon intersects a set of ordered point series.
[public]
check if this polygon is inside the given rectangle.
[public]
check if this polygon is inside the given circle.
Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999 | Kdoc |