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 |
|||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
===== | Check the relation (outside, inside, overlap) of a given point, line or simple polygon ''p'' to the polygon ''x''. | ||
---- | |||
;Usage 1: | |||
:<code>pgitest(<var>X</var>, <var>IX</var>, <var>PX<sub>scalar</sub></var>, <var>PY<sub>scalar</sub></var>)</code> | |||
:;<var>X</var>:a [[../#polygons|closed point-list]] or a [[../#polygons|polygon-stream]] defining one or more polygons. | |||
:;<var>IX</var>:The index of the polygon of ''X'' to be tested; 0 <= <var>IX</var> < ''N'' (= <code>[[../pgget|pgget]](''X'')</code>) | |||
:;<var>PX, PY</var>: The point ''P''=<''PX'',''PY''> to be tested. | |||
;Result 1: The result ''r'' is a scaler. | |||
:{|class="keinrahmen" | |||
|''r''='''0''' | ... point ''P'' is outside the polygon | |||
|''r''='''1''' | ... point ''P'' is inside the polygon | |||
|} | |||
:<code>pgitest(<var>X</var>, <var>I</var>, <var>PX<sub>scalar</sub></var>, <var>PY<sub>vector</sub></var>)</code> | |||
:<code>pgitest(<var>X</var>, <var>I</var>, <var>PX<sub>vector</sub></var>, <var>PY<sub>scalar</sub></var>)</code> | |||
:<code>pgitest(<var>X</var>, <var>I</var>, <var>PX<sub>vector</sub></var>, <var>PY<sub>vector</sub></var>)</code> | |||
===== | :;<var>X</var>:A [[../#polygons|closed point-list]] or a [[../#polygons|polygon-stream]] defining one or more polygons. | ||
;Result 1: The number of [[../#polygons|simple polygons]] ''N'' stored in ''X''. If the result is '''0''', ''X'' contains no valid polygons. | |||
---- | |||
;Usage 2:<code>pgget(<var>X</var>, <var>I</var>, <var>fmt</var>)</code> | |||
:;<var>X</var>:A [[../#polygons|closed point-list]] or a [[../#polygons|polygon-stream]] defining one or more polygons. | |||
:;<var>I</var>:The index of the polygon to be returned; 0 <= <var>I</var> < ''N'' (= <code>pgget(''X'')</code>) | |||
:;<var>fmt</var>:The format of the result.: | |||
::{|class="keinrahmen" | |||
|''fmt''=0 ||... return the ''I''-th polygon of ''X'' as [[../#polygons|polygon-stream]] | |||
|- | |||
|''fmt''=1 ||... return the [[../#polygons|polygon-stream]] header (a 8x2 matrix) of the ''I''-th polygon of ''X'' | |||
|} | |||
;Result 2: The ''I''-th polygon stored in ''X'' in the format selected by ''fmt''. | |||
---- | |||
;See also: [[../pginit|pginit]], [[../pgitest|pgitest]], [[../pgiline|pgiline]], [[../pgxgrid|pgxgrid]], [[../pgsplit|pgsplit]], [[../pgtrans|pgtrans]], [[../pghull|pghull]] | |||
[[../#Functions|<function list>]] | |||
Revision as of 07:48, 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 < N (=
pgget(X)
) - PX, PY
- The point P=<PX,PY> to be tested.
- Result 1
- The result r is a scaler.
... point P is outside the polygon ... point P is inside the polygon
pgitest(X, I, PXscalar, PYvector)
pgitest(X, I, PXvector, PYscalar)
pgitest(X, I, PXvector, PYvector)
- X
- A closed point-list or a polygon-stream defining one or more polygons.
- Result 1
- The number of simple polygons N stored in X. If the result is 0, X contains no valid polygons.
- Usage 2
pgget(X, I, fmt)
- X
- A closed point-list or a polygon-stream defining one or more polygons.
- I
- The index of the polygon to be returned; 0 <= I < N (=
pgget(X)
) - fmt
- The format of the result.:
fmt=0 ... return the I-th polygon of X as polygon-stream fmt=1 ... return the polygon-stream header (a 8x2 matrix) of the I-th polygon of X
- Result 2
- The I-th polygon stored in X in the format selected by fmt.