To run lots of trs_apply examples I built the script named Run_trs_apply. Just like my first demo, it build the input X,Y set from a local file named t.1. It runs trs_apply and also constructs files that make it easy to plot various parts of the transformation sequence. Below I first show a sample run that reproduces our first example. Then I show the run script
% ls Run_trs_apply* TRS % cp ../S/* . % ls Run_trs_apply* t.1 TRS % cat TRS 500.0 500.0 N 1.0 20.0 0.0 0.0 % Run_trs_apply 1 # I enter the name of my data file (t.1) A plot appears and I use it to make the figure directly below. # # To see every step that was performed: % cat trs_apply_ex.STEPS Steps performed by trs_apply_ex: Step1: trs_translate.sh file1.xy 500.0 500.0 Step2: trs_reflect.sh xy.step1_translate N Step3: trs_scale.sh xy.step2_reflect 1.0 Step4: trs_rotate.sh xy.step3_scale 20.0 Step5: trs_translate.sh xy.step4_rotate 0.0 0.0
![]() |
An example of a trs_apply run (using Run_trs_apply) to demonstrate a single translation (linear shift in X and Y). Here we see that the original (red squares) Point1 at X,Y=500,500 has been translated to X,Y=0,0. Beyond this, the transformed points (the blue hexagons) have not been altered using reflection, scale change, or rotation. The TRS parameters used in this trs_apply run are given as the plot title. |
****** Here is Run_trs_apply ********* #!/bin/bash # Check command line args if [ -z "$1" ] then printf "Usage:Run_trs_apply_ex 2 \n" printf "arg1 - integer number for example number \n" printf "Note: The trs paramters are read from ./TRS file. \n" exit fi # 500.0 500.0 N 1.0 0.0 -450.0 -490.0 # Read the transformation values if [ -e "TRS" ] then read XoS YoS flip scal rot XoF YoF < TRS else printf "\n\tError: There is no local TRS file.\n " exit fi # Make the TRS file for this example printf " $XoS $YoS $flip $scal $rot $XoF $YoF\n" > TRS.$1 # Start to build new Style file printf "TRS: $XoS $YoS $flip $scal $rot $XoF $YoF \n" > Style.file_$1 printf "X axis\nY axis\nXY0.plot\n" >> Style.file_$1 # Build the test data set trs_make_xy_TestData read cp XY0.data file1.xy # Run the transformation trs_apply_ex file1.xy TRS.$1 Y > file2.xy # Build the plot file to add the new set (file2.xy) trs_build_plot_file file2.xy b h 90 15 "FINAL set" > XY2.plot printf "XY2.plot\n" >> Style.file_$1 # Plot the set trs_plot.py Style.file_$1 -600 1200 -600 1200 SHOW