---------------------------------
HELMERTT - HELMERT transformation
---------------------------------

for HP48G (June 30 1997) and HP49G (added May 8 2002)
F.Reichert <f-rei@web.de> 


{[v2]..[v2]} {[v2]..[v2]} {[v2]..[v2]}    ---->     {tx ty sc rot} {[v2]..[v2]}

Helmert transformation is a 4 parameter transformation ( 2 translations,  1 ro-
tation, 1 scale) between two plain coordinate systems. 
This transformation is overdetermined in case of  more than 2 control points in 
each system. A solution that satisfies all transformation inputs may not exist. 
HELMERTT returns  the solution  with  the minimum  residuals of control points.

Input:
HELMERTT requires three lists of two-dimensional vectors as arguments.  Put the 
control points  into  stack level  3 and 2,  but  make sure that  the number of 
points in both source and destination system are identical,  and the points it-
self are in same order.  Level 1  holds  the points to be transformed.

Output:
After evaluating  HELMERTT  you'll get transformed points in  stack level 1 and 
transformation parameters (translations, scale, rotation) in the 2nd level.

Example:

4:
3:{[1 2] [3 4] [5 6]}    <-- CP's in source system
2:{[2 4] [6 8] [10 12]}  <-- CP's in destination system
1:{[1 1] [1 2]}          <-- points to transform

If you have  stored some points  in variables (e.g. P: [1 2] ) your stack could 
look like this:

4:
3:{ P [3 4] [5 6]}
2:{[2 4] [6 8] [10 12]}
1:{[1 1] P }
HELM| P |   |   |   |


--------------------------------------
... und das ganze mochmal auf Deutsch:
--------------------------------------

Die Helmerttransformation ist eine  4-Parametertransformation ( mit 2 Verschie-
bungen,  einer Drehung und einem Mastabsfaktor)  zwischen zwei ebenen kartesi- 
schen Koordinatensystemen.  Bei mehr als 2 Passpunkten je System ist die Trans-
formation berbestimmt, so dass keine exakte Lsung existiert.  Die bestehenden
Klaffungen werden nach der Methode der kleinsten Quadrate minimiert.

Input:
HELMERTT bentigt als Eingabe drei Listen zweidimensionaler Vektoren. Die Pass-
punkte von Quell- und Zielsystem kommen in die Stackebenen 3 und 2.  Dabei muss
die Punktanzahl- und Reihenfolge bereinstimmen.  In der untersten Ebene mssen
die umzuformenden Punkte (aus dem Quellsystem, Level 3) stehen. Dabei sind auch
Variablen erlaubt, z. B. {[1 1] P }

Output:
Nach der Berechnung von HELMERTT  stehen die transformierten Punkte in Ebene 1,
in der zweiten die Transformationsparameter (Translationen, Drehung, Mastab).

Beispiel: s.o.
