Programmer Guide/Command Reference/EVAL/pgtrans: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(6 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
Shift, scale and/or rotate a polygon. | Shift, scale and/or rotate a polygon. | ||
;Usage: | ;Usage: | ||
:<code>pgtrans(<var>X</var>, <var>IX</var> {, <var>DX</var>, <var>DY</var> | :<code>pgtrans(<var>X</var>, <var>IX</var> {, <var>DX</var>, <var>DY</var>, <var>KX</var>, <var>KY</var>, <var>A</var>})</code> | ||
:;<var>X</var>:a [[../#polygons|closed point-list]] or a [[../#polygons|polygon-stream]] defining one or more polygons. | :;<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>:The index of the polygon of ''X'' to be tested; 0 ≤ <var>IX</var> < <code>[[../pgget|pgget]](''X'')</code> | ||
:;<var>DX, DY</var>: shift values for x and y (default=0, no shift) | :;<var>DX, DY</var>: shift values for x and y (default=0, no shift) | ||
:: | ::* shift the center point <code><xc,yc></code> of ''X<sub>IX</sub>'' | ||
:::<code><x[i] , y[i]> → <x[i]+<var>DX</var> , y[i]+<var>DY</var>></code> | |||
:;<var>KX, KY</var>: scaling factors; both factors must be greater than zero (default=1, no scaling) | :;<var>KX, KY</var>: scaling factors; both factors must be greater than zero (default=1, no scaling) | ||
::* scale the distances of corners of ''X<sub>IX</sub>'' to the center point | |||
:::<code><x[i] , y[i]> → <(x[i]-xc)*<var>KX</var>+xc , (y[i]-yc)*<var>KY</var>'+yc></code> | |||
:;<var>A</var>: rotation angle in degree (default=0, no rotation); a scaling factors (default=1) | :;<var>A</var>: rotation angle in degree (default=0, no rotation); a scaling factors (default=1) | ||
::rotate the polygon around the center point | ::*rotate the polygon around the center point | ||
;Result: The result ''r'' is a [[../#polygons|polygon-stream]] containing the transformed ''X<sub>IX</sub>''. | ;Result: The result ''r'' is a [[../#polygons|polygon-stream]] containing the transformed ''X<sub>IX</sub>''. | ||
;See also: [[../pginit|pginit]], [[../pgget|pgget]], [[../pgitest|pgitest]], [[../ | ;See also: [[../pginit|pginit]], [[../pgget|pgget]], [[../pgitest|pgitest]], [[../pgiline|pgiline]], [[../pgxgrid|pgxgrid]], [[../pgsplit|pgsplit]], [[../pghull|pghull]] | ||
[[../#Functions|<function list>]] | [[../#Functions|<function list>]] |
Latest revision as of 19:28, 21 April 2011
Shift, scale and/or rotate a polygon.
- Usage
pgtrans(X, IX {, DX, DY, KX, KY, A})
- 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)
- DX, DY
- shift values for x and y (default=0, no shift)
- shift the center point
<xc,yc>
of XIX
<x[i] , y[i]> → <x[i]+DX , y[i]+DY>
- shift the center point
- KX, KY
- scaling factors; both factors must be greater than zero (default=1, no scaling)
- scale the distances of corners of XIX to the center point
<x[i] , y[i]> → <(x[i]-xc)*KX+xc , (y[i]-yc)*KY'+yc>
- A
- rotation angle in degree (default=0, no rotation); a scaling factors (default=1)
- rotate the polygon around the center point