polygonDifference()

Synopsis

Returns a list of polygons which represent the areas of poly1 that remain when the area of poly2 is removed.

Polygons are represented in a "lightweight" way by a list of points. The first three non-colinear points define the "plane" of the polygon, and even if the rest of the points do not lie in that plane, they will be projected onto that plane for all computations.

Syntax

polygonDifference ( poly1 As List, _
                    poly2 As List ) As List 
Argument Type Description
poly1 List The original polygon.
poly2 List The polygon to be removed.

Example 1

Intent >polygonDifference({point(0,0,0), Point(5,0,0), Point(5,5,0), Point(0,5,0)}, {Point(1,1,0), Point(6,1,0), Point(6,4,0), Point(1,4,0)}) 
--> {{Point_(1.0, 1.0, 0.0, WorldFrame()), Point_(1.0, 4.0, 0.0, WorldFrame()), Point_(5.0, 4.0, 0.0, WorldFrame()), Point_(5.0, 5.0, 0.0, WorldFrame()), Point_(0.0, 5.0, 0.0, WorldFrame()), Point_(0.0, 0.0, 0.0, WorldFrame()), Point_(5.0, 0.0, 0.0, WorldFrame()), Point_(5.0, 1.0, 0.0, WorldFrame())}} 

Example 2

The same polygons as in Example 1, but in reverse order:
Intent >polygonDifference({Point(1,1,0), Point(6,1,0), Point(6,4,0), Point(1,4,0)}, {point(0,0,0), Point(5,0,0), Point(5,5,0), Point(0,5,0)}) 
--> {{Point_(6.0, 1.0, 0.0, WorldFrame()), Point_(6.0, 4.0, 0.0, WorldFrame()), Point_(5.0, 4.0, 0.0, WorldFrame()), Point_(5.0, 1.0, 0.0, WorldFrame())}}