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

From STX Wiki
Jump to navigationJump to search
(initial import)
 
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====pgget - count number of polygons=====
Extract a polygon from a [[../#polygons|closed point-list]] or a [[../#polygons|polygon-stream]].
----
;Usage 1:<code>pgget(<var>X</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 &le; <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]]


=====Usage:=====
[[../#Functions|<function list>]]
 
<code>N := eval pgGet( {pg_cplist}<var>X</var> )</code>
 
<code>N := eval pgGet( {pg_stream}<var>X</var> )</code>
 
=====Function:=====
 
Count the number of polygons stored in a polygon-stream or point-list.
 
=====Parameters:=====
 
;<var>X</var>
 
:A polygon-stream or point-list.
 
=====Result:=====
 
The number of simple-polygons defined by the pg_cplist X or contained in the pg_stream X.
 
Note that <code>0</code> is returned if <var>X</var> is invalid.
 
=====Usage:=====
 
<code>P := pgGet( {pg_cplist}<var>X</var>, {number}<var>I</var>, {number}<var>FMT</var>=0 )</code>
 
<code>P := pgGet( {pg_stream}<var>X</var>, {number}<var>I</var>, {number}<var>FMT</var>=0 )</code>
 
=====Function:=====
 
Extract the polygon data or header from a polygon-stream or point-list.
 
=====Parameters:=====
 
;<var>X</var>
 
:A point-list or polygon-stream.
 
;<var>I</var>
 
:The index of the polygon to extract.
 
;<var>FMT</var>
 
:The polygon type to return. The following values are supported:
 
:0 - return the <var>I</var>-th polygon stored in <var>X</var> as a polygon stream.
 
:1 - return the <var>I</var>-th polygon stored in <var>X</var> as a simple polygon.
 
:2 - return the header of the <var>I</var>-th polygon stored in <var>X</var> (8 x 2 matrix, see description of [[Programmer Guide/Command Reference/EVAL/Polygons|pg_stream]])
 
=====Result:=====
 
Returns either a simple-polygon, polygon-stream or polygon header, depending on <var>FMT</var>.
 
=====pghull - compute hull polygon=====
 
=====Usage:=====
 
<code><var>H</var> := pgHull( {pg_stream}<var>XS</var>, {number}<var>IX</var>, {pg_stream}<var>YS</var>, {number}<var>IY</var> )</code>
 
=====Description:=====
 
Compute the hull-polygon of two simple-polygons.
 
=====Parameters:=====
 
;<var>XS</var>
 
:The first polygon stream.
 
;<var>IX</var>
 
:The index of the simple polygon in the polygon stream <var>XS</var>.
 
;<var>YS</var>
 
:The second polygon stream.
 
;<var>IY</var>
 
:The index of the simple polygon in the polygon stream <var>YS</var>.
 
=====Result:=====
 
The polygon stream <var>H</var> containing the hull of the polygons <var>XS</var>[<var>IX</var>] and <var>YS</var>[<var>IY</var>].

Latest revision as of 19:12, 21 April 2011

Extract a polygon from a closed point-list or a polygon-stream.


Usage 1
pgget(X)
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.

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

<function list>

Navigation menu

Personal tools