pgiline
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
Find all intersections of a line, defined by the starting and the ending point, with the polygon x.
- Usage
pgiline(X, IX, PX1scalar, PY1scalar), PX2scalar, PY2scalar)
- PX1, PY1, PX2, PY2
- The start point <PX1,PY1> and the end point <PX2,PY2> of the line P to be tested.
- Result 3
- The result r is a scalar.
r=0 ... the line P is outside the polygon XIX r=1 ... the line P is inside the polygon XIX r=2 ... the line P intersects the polygon XIX
- Usage 4
pgitest(X, IX, P, IP)
- P
- a closed point-list or a polygon-stream defining one or more polygons.
- IP
- The index of the polygon of P to be tested; 0 <= IP <
pgget(P)
)
- Result 4
- The result r is a scalar.
r=0 ... the polygon PIP is outside the polygon XIX r=1 ... the polygon PIP is included in the polygon XIX r=2 ... the polygons PIP and XIX are partly overlapping r=3 ... the polygon XIX is included in the polygon PIP
- 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