English

How To: Create a hole in a polygon

Summary

This article explains how to create a donut-hole style polygon.

Procedure

Use the SOAP object PolygonDesc to create a single geometry object that contains a hole.

  1. Set one part to specify the outer boundary of the polygon.
  2. Set another part to determine the boundary of the hole. The hole's boundary points must be ordered in the opposite direction from the polygon's points (in other words, counter-clockwise vs. clockwise).

    Example:
    Code:
    point1.x = -117
    point1.y = 34

    point2.x = -120
    point2.y = 34

    point3.x = -120
    point3.y = 37

    point4.x = -117
    point4.y = 37

    geometry1.points = {point1, point2, point3, point4}

    point5.x = -118
    point5.y = 35

    point6.x = -118
    point6.y = 36

    point7.x = -119
    point7.y = 36

    point8.x = -119
    point8.y = 35

    geometry2.points = {point5, point6, point7, point8}

    Geometry2 now has a hole within geometry 1.