Programmer Guide/Command Reference/EVAL/pgitest: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
;Result 1: The result ''r'' is a scaler. | ;Result 1: The result ''r'' is a scaler. | ||
::{|class="keinrahmen" | ::{|class="keinrahmen" | ||
|''r''='''0''' || ... point ''P'' is outside the polygon | |''r''='''0''' || ... point ''P'' is outside the polygon ''X<sub>IX</sub>'' | ||
|- | |- | ||
|''r''='''1''' || ... point ''P'' is inside the polygon | |''r''='''1''' || ... point ''P'' is inside the polygon ''X<sub>IX</sub>'' | ||
|} | |} | ||
---- | ---- | ||
;Usage | ;Usage 2: | ||
:<code>pgitest(<var>X</var>, <var>IX</var>, <var>PX<sub>scalar</sub></var>, <var>PY<sub>vector</sub></var>)</code> | :<code>pgitest(<var>X</var>, <var>IX</var>, <var>PX<sub>scalar</sub></var>, <var>PY<sub>vector</sub></var>)</code> | ||
:<code>pgitest(<var>X</var>, <var>IX</var>, <var>PX<sub>vector</sub></var>, <var>PY<sub>scalar</sub></var>)</code> | :<code>pgitest(<var>X</var>, <var>IX</var>, <var>PX<sub>vector</sub></var>, <var>PY<sub>scalar</sub></var>)</code> | ||
:<code>pgitest(<var>X</var>, <var>IX</var>, <var>PX<sub>vector</sub></var>, <var>PY<sub>vector</sub></var>)</code> | :<code>pgitest(<var>X</var>, <var>IX</var>, <var>PX<sub>vector</sub></var>, <var>PY<sub>vector</sub></var>)</code> | ||
:;<var>PX, PY</var>: The points ''P''[i]=<''PX''[i],''PY''[i]> to be tested. One of these arguments must be a vector. | :;<var>PX, PY</var>: The points ''P''[i]=<''PX''[i],''PY''[i]> to be tested. One of these arguments must be a vector. | ||
;Result | ;Result 2: The result ''r'' is a vector containing the test result for each point ''P''[i]. | ||
::{|class="keinrahmen" | ::{|class="keinrahmen" | ||
|''r''[i]='''0''' || ... point ''P''[i] is outside the polygon | |''r''[i]='''0''' || ... point ''P''[i] is outside the polygon ''X<sub>IX</sub>'' | ||
|- | |- | ||
|''r''[i]='''1''' || ... point ''P''[i] is inside the polygon | |''r''[i]='''1''' || ... point ''P''[i] is inside the polygon ''X<sub>IX</sub>'' | ||
|} | |} | ||
---- | |||
;Usage 3: | |||
:<code>pgitest(<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>PX1, PY1, PX2, PY2</var>: 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. | |||
:;<var> | ::{|class="keinrahmen" | ||
|''r''='''0''' || ... the line ''P'' is outside the polygon ''X<sub>IX</sub>'' | |||
|- | |||
|''r''='''1''' || ... the line ''P'' is inside the polygon ''X<sub>IX</sub>'' | |||
|- | |||
|''r''='''2''' || ... the line ''P'' intersects the polygon ''X<sub>IX</sub>'' | |||
|} | |||
---- | ---- | ||
;Usage | ;Usage 4: | ||
:;<var> | :<code>pgitest(<var>X</var>, <var>IX</var>, <var>P</var>, <var>IP</var>)</code> | ||
:;<var> | :;<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" | ::{|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>'' | |||
|- | |||
|''r''='''2''' || ... the polygons ''P<sub>IP</sub>'' and ''X<sub>IX</sub>'' are partly overlapping | |||
|- | |- | ||
|'' | |''r''='''3''' || ... the polygon ''X<sub>IX</sub>'' is included in the polygon ''P<sub>IP</sub>'' | ||
|} | |} | ||
---- | ---- | ||
;See also: [[../pginit|pginit]], [[../ | ;See also: [[../pginit|pginit]], [[../pgget|pgget]], [[../pgiline|pgiline]], [[../pgxgrid|pgxgrid]], [[../pgsplit|pgsplit]], [[../pgtrans|pgtrans]], [[../pghull|pghull]] | ||
[[../#Functions|<function list>]] | [[../#Functions|<function list>]] |
Revision as of 08:10, 20 April 2011
Check the relation (outside, inside, overlap) of a given point, line or simple polygon p to the polygon x.
- Usage 1
pgitest(X, IX, PXscalar, PYscalar)
- 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)
) - PX, PY
- The point P=<PX,PY> to be tested.
- Result 1
- The result r is a scaler.
r=0 ... point P is outside the polygon XIX r=1 ... point P is inside the polygon XIX
- Usage 2
pgitest(X, IX, PXscalar, PYvector)
pgitest(X, IX, PXvector, PYscalar)
pgitest(X, IX, PXvector, PYvector)
- PX, PY
- The points P[i]=<PX[i],PY[i]> to be tested. One of these arguments must be a vector.
- Result 2
- The result r is a vector containing the test result for each point P[i].
r[i]=0 ... point P[i] is outside the polygon XIX r[i]=1 ... point P[i] is inside the polygon XIX
- Usage 3
pgitest(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