Programmer Guide/Command Reference/EVAL/pgiline: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 3: Line 3:
;Usage:
;Usage:
:<code>pgiline(<var>X</var>, <var>IX</var>, <var>PX1<sub>scalar</sub></var>, <var>PY1<sub>scalar</sub></var>), <var>PX2<sub>scalar</sub></var>, <var>PY2<sub>scalar</sub></var>)</code>
:<code>pgiline(<var>X</var>, <var>IX</var>, <var>PX1<sub>scalar</sub></var>, <var>PY1<sub>scalar</sub></var>), <var>PX2<sub>scalar</sub></var>, <var>PY2<sub>scalar</sub></var>)</code>
 
:;<var>X</var>:a [[../#polygons|closed point-list]] or a [[../#polygons|polygon-stream]] defining one or more polygons.
:;<var>PX1, PY1, PX2, PY2</var>: The start point <''PX1'',''PY1''> and the end point <''PX2'',''PY2''> of the line ''P'' to be tested.
:;<var>IX</var>:The index of the polygon of ''X'' to be tested; 0 <= <var>IX</var> < <code>[[../pgget|pgget]](''X'')</code>)
;Result 3: The result ''r'' is a scalar.
:;<var>PX1, PY1, PX2, PY2</var>: The start point <''PX1'',''PY1''> and the end point <''PX2'',''PY2''> of the line to be tested.
::{|class="keinrahmen"
;Result 3: The result ''r'' is a Nx3 matrix. Each row of the matrix contains the coordinates of a point of the line and its state.
|''r''='''0''' || ... the line ''P'' is outside the polygon ''X<sub>IX</sub>''
::{class="einrahmen"
! i !! ''r''[i,0], ''r''[i,1] !! ''r''[i,2]
|-
|-
|''r''='''1''' || ... the line ''P'' is inside the polygon ''X<sub>IX</sub>''
|0
|start point of the line
|0 if the start point is outside ''X<sub>IX</sub>''<BR>1 if the start point is inside ''X<sub>IX</sub>''
|-
|-
|''r''='''2''' || ... the line ''P'' intersects the polygon ''X<sub>IX</sub>''
|1 .. N-2
|}
|intersection point
----
|0 if the line leaves ''X<sub>IX</sub>''<BR>1 if the line enters ''X<sub>IX</sub>''
;Usage 4:
:<code>pgitest(<var>X</var>, <var>IX</var>, <var>P</var>, <var>IP</var>)</code>
:;<var>P</var>:a [[../#polygons|closed point-list]] or a [[../#polygons|polygon-stream]] defining one or more polygons.
:;<var>IP</var>:The index of the polygon of ''P'' to be tested; 0 <= <var>IP</var> < <code>[[../pgget|pgget]](''P'')</code>)
;Result 4: The result ''r'' is a scalar.
::{|class="keinrahmen"
|''r''='''0''' || ... the polygon ''P<sub>IP</sub>'' is outside the polygon ''X<sub>IX</sub>''
|-
|-
|''r''='''1''' || ... the polygon ''P<sub>IP</sub>'' is included in the polygon ''X<sub>IX</sub>''
|N-1  
|-
|end point of the line
|''r''='''2''' || ... the polygons ''P<sub>IP</sub>'' and ''X<sub>IX</sub>'' are partly overlapping
|0 if the end point is outside ''X<sub>IX</sub>''<BR>1 if the end point is inside ''X<sub>IX</sub>''
|-
|''r''='''3''' || ... the polygon ''X<sub>IX</sub>'' is included in the polygon ''P<sub>IP</sub>''
|}
|}
----
;See also: [[../pginit|pginit]], [[../pgget|pgget]], [[../pgiline|pgiline]], [[../pgxgrid|pgxgrid]], [[../pgsplit|pgsplit]], [[../pgtrans|pgtrans]], [[../pghull|pghull]]
;See also: [[../pginit|pginit]], [[../pgget|pgget]], [[../pgiline|pgiline]], [[../pgxgrid|pgxgrid]], [[../pgsplit|pgsplit]], [[../pgtrans|pgtrans]], [[../pghull|pghull]]




[[../#Functions|<function list>]]
[[../#Functions|<function list>]]
;<var>X2, Y2</var>
:The x/y coordinate of the last point in the line.
=====Result:=====
Detect intersections of the line <<var>X1</var>,<var>Y1</var>>..<<var>X2</var>,<var>Y2</var>> and the polygon <var>XS</var>[<var>IX</var>].
The result <var>IS</var> 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

Revision as of 09:27, 20 April 2011

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)
X
a closed point-list or a polygon-stream defining one or more polygons.
IX
The index of the polygon of X to be tested; 0 <= IX < pgget(X))
PX1, PY1, PX2, PY2
The start point <PX1,PY1> and the end point <PX2,PY2> of the line to be tested.
Result 3
The result r is a Nx3 matrix. Each row of the matrix contains the coordinates of a point of the line and its state.
{class="einrahmen"

! i !! r[i,0], r[i,1] !! r[i,2] |- |0 |start point of the line |0 if the start point is outside XIX
1 if the start point is inside XIX |- |1 .. N-2 |intersection point |0 if the line leaves XIX
1 if the line enters XIX |- |N-1 |end point of the line |0 if the end point is outside XIX
1 if the end point is inside XIX |}

See also
pginit, pgget, pgiline, pgxgrid, pgsplit, pgtrans, pghull


<function list>

Navigation menu

Personal tools