pgiline
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
pgiline - detect line intersection
Usage:
IS := pgILine( {pg_stream}XS, {number}IX, {number}X1, {number}Y1, {number}X2, number{Y2} )
Description:
Detect intersections of a simple-polygon with a straight line.
Parameters:
- XS
- The polygon stream containing the simple polygon, or point list describing the simple polygon.
- IX
- The index of the polygon describing the simple polygon.
- X1, Y1
- The x/y coordinate of the first point in the line.
- X2, Y2
- The x/y coordinate of the last point in the line.
Result:
Detect intersections of the line <X1,Y1>..<X2,Y2> and the polygon XS[IX].
The result IS is an "N x 3" matrix:
row 0: col0,col1 x and y of start-point
col2 0 if start-point outside and 1 if start-point inside the polygon
...
row i: col0,col1 x and y of intersection point i (i = 1 .. N-2)
col2 0 if the line leaves and 1 if the line enters the polygon
...
row N-1: col0,col1 x and y of end-point
col2 0 if end-point outside and 1 if end-point inside the polygon