tr
tr moves the vertices of a region by a transformation built from a list of operators.
Syntax
tr imin jmin kmin imax jmax kmax operator [ operator ... ] ;
imintokmax: a region of reduced indices. A0in a minimum means the first reduced index of its direction and a0in a maximum the last. The concepts chapter explains regions.operator: one of the thirteen below, each with its arguments. James combines them from left to right into one transformation. The list ends in;, which is required, because James reads words after the last operator as more operators.
| Operator | Arguments | Effect |
|---|---|---|
mx, my, mz | distance | translate along one axis |
v | dx dy dz | translate by a vector |
rx, ry, rz | angle in degrees | rotate about the x, y or z axis through the origin |
raxis | angle x0 y0 z0 xn yn zn | rotate about the axis through (x0, y0, z0) in direction (xn, yn, zn) |
inv | none | invert the transformation built so far |
csca | factor | scale all three coordinates about the origin |
xsca, ysca, zsca | factor | scale one coordinate about the origin |
James refuses five more operators, tf, ftf, rxy, ryz and rzx.
What it does
tr applies the one combined transformation to every vertex in the region. In a cylinder part tr works in Cartesian coordinates whatever the part’s own system is. James converts each vertex to Cartesian coordinates, transforms it and converts it back, with the angle taken on the branch nearest the vertex’s previous angle.
When James applies it
Step 1iii of the hierarchy, in input order within the step, as pb describes. tr is legal only in the Part phase.
Rules James adds
- The thirteen operators above are the whole list in this version.
tf,ftf,rxy,ryzandrzxare recognised, and James refuses each with E0503 and a message that names the operator. - A transformation that cannot be inverted, such as
csca 0followed byinv, is an engine error. - On a
cylinderpart a vertex on the axis keeps its previous angle.
Diagnostics
- E0500: a reduced index lies outside the part.
- E0503: an operator is unknown, malformed or one of the five refused.
- E0504:
raxishas a direction of zero length. - E0106: a minimum is larger than its maximum.
Example
The script tests/corpus/169-tr-rotates-face-about-z/input.tg, which make test runs:
c tr rotates the i = 1 face by 15 degrees about the z axis.
block 1 3 5;1 3 5;1 2;1 2 3;0 1 2;0 1;
tr 1 1 1 1 3 2 rz 15;
endpart
The region 1 1 1 1 3 2 is the i = 1 face, which lies in the plane x = 1. The IR shows one transformation row, rz 15, and the tr command that refers to it. The mesh has node 1, which was at (1, 0, 0), at (0.9659, 0.2588, 0). The nodes between the face and the others follow by interpolation.