Table of Contents
A standard interface to the pclip (polygon/polygon intersection) standalone engine executable.
All face lists are described such that the first index indicates how many faces are in the face. For example,
[3, 1, 2, 3, 3, 4, 5, 6]
States that there are 3 vertexes in the first face, and those vertexes are 1, 2, 3. Then the next face contains 3 vertexes, which are 4, 5, 6. This may seem a bit confusing, but using this structure buys us some definite efficiencies. Note that all faces in MineSight® products have 3 vertexes.
Note
Be careful with the filepath strings used in these functions. Since the backslash character is used in Python as an escape character, it is best to use forward slashes (or two backslashes) in the filepaths.
Most arguments in these functions correspond to an option in the Standalone engine. All arguments in these functions have a default value of 'None', which makes the arguments optional. If left unspecified, the option will not be included in the call to the engine executable. Calls to these functions must use `keyword arguments` (keywords are the formal parameter names). See the examples below for more details.
pclip(pointLists1, pointLists2, oper1, oper2, int, union, diff, f, R, dat, debug)
Polygon/Polygon intersection program. The function returns either the intersection, union, or difference of the polygons.
- Arguments:
- pointLists1 : a list of point_lists
- Point lists of the polygon set #1
- pointLists2 : a list of point_lists
- Point lists of the polygon set #2
- oper1 : string
- A pre-processing operation over input polygon set #1 to be performed before other calculations. Either 'n', 's', or 'c', where:
- n=No preprocessing (DEFAULT); s=Separate polygons into independent sets; c=Combine all polygons in one.
- oper2 : string
- A pre-processing operation over input polygon set #2. See above.
- int : integer
- Output intersection of input polygons. Set value to 1 to turn on this option.
- union : integer
- Output union of input polygons. Set value to 1 to turn on this option.
- diff : integer
- Output difference of input polygons. Set value to 1 to turn on this option.
- f : integer
- Validate polygons before intersection. Set to either 0 or 1, where:
- 0 = make external and internal polygons to have opposite direction (DEFAULT); 1 = use original direction of polygons.
- R : integer
- Reverse polygons (external oriented clockwise). Set value to 1 to turn on this option.
- dat : string
- Define a directory with input files.
- debug : integer
- Debug option will output the command string used to call the engine executable and will relay any output messages from the engine. Set value to 1 to turn on this option.
- Returns:
- A list of point_lists (see Standard Definitions).
- Example:
from grail.engines import pclip
polygon1 = [[2.0, 0.0, 3895.0],[4.0, 0.0, 3895.0],[4.0, 2.0, 3895.0],[2.0, 2.0, 3895.0],[2.0, 0.0, 3895.0]]
polygon2 = [[1.0, 0.0, 3895.0],[3.0, 0.0, 3895.0],[3.0, 2.0, 3895.0],[1.0, 2.0, 3895.0],[1.0, 0.0, 3895.0]]
#use keyword arguments in function call
listOfPointLists = pclip.pclip(pointLists1=[polygon1], pointLists2=[polygon2], int=1, R=1)
intersectionPolygon = listOfPointLists[0]