| lintran | lists | lintran |
lintran -- perform a linear transformation of a list
lintran files
Specified fields from the input list can be scaled, rotated and shifted. Two fields of each input line are designated as the x and y coordinates to be transformed (default: fields 1, 2). All other fields are be preserved across the transformation. For clarification, the equations used in the transformation are shown below:
1. Subtract off the current origin:
xt = x - x1
yt = y - y1
2. Scale and rotate the coordinates:
xs = xt * xscale
ys = yt * yscale
xt = xs * cos(angle) - ys * sin(angle)
yt = xs * sin(angle) + ys * cos(angle)
3. Shift to the new origin:
xt = xt + x2
yt = yt + y2
Comment lines and blank lines are passed on to the output unmodified (a comment line is any line beginning with the character #). If either x or y is indefinite and no rotation is being performed, the corresponding output coordinate will be indefinite. If either input coordinate is indefinite and a rotation is being performed, both output coordinates will be indefinite.
1. Shift the coordinate list frame1 so it represents positions in a second exposure of a star field, not registered with the first. Take the coordinates of a star in frame1 to be the current origin (e.g., [35.7, 389.2]); the new origin is then the coordinates of the same star in the second exposure ([36.9, 400.0]). The shifted list is saved in file "frame2":
cl> lintran frame1 x1=35.7 y1=389.2 x2=36.9 y2=400.0 > frame2
2. Apply a shift of +3.4 units in x, -1.3 units in y to the input list read from the standard input, writing the output list on the standard output.
cl> list_stream | lintran x2=3.4 y2=-1.3
3. Rotate a coordinate list of a 800x800 frame by 90 degrees. The rotated coordinate list would represent positions in the field if it had been rotated, for example, from East to the right to East to the top. Note that the rotation takes place about the central pixel [400.50,400.50] and that the current and new origins are the same:
cl> lintran picture x1=400.5 y1=400.5 x2=400.5 y2=400.5 angle=90