title: how to perform coordinates affine transformation using python?
body: <p>I would like to perform transformation for this example data set.<br>
  There are four known points with coordinates x, y, z in one coordinate[primary_system] system and next four known points with coordinates x, y, h that belong to another coordinate system[secondary_system].
  Those points correspond; for example primary_system1 point and secondary_system1 point is exactly the same point but we have it's coordinates in two different coordinate systems.
  So I have here four pairs of adjustment points and want to transform another point coordinates from primary system to secondary system according to adjustment.</p>
  
  <pre><code>primary_system1 = (3531820.440, 1174966.736, 5162268.086)
  primary_system2 = (3531746.800, 1175275.159, 5162241.325)
  primary_system3 = (3532510.182, 1174373.785, 5161954.920)
  primary_system4 = (3532495.968, 1175507.195, 5161685.049)
  
  secondary_system1 = (6089665.610, 3591595.470, 148.810)
  secondary_system2 = (6089633.900, 3591912.090, 143.120)
  secondary_system3 = (6089088.170, 3590826.470, 166.350)
  secondary_system4 = (6088672.490, 3591914.630, 147.440)
  
  #transform this point
  x = 3532412.323 
  y = 1175511.432
  z = 5161677.111&lt;br&gt;
  </code></pre>
  
  <p><br> at the moment I try to average translation for x, y and z axis using each of the four pairs of points like:<br></p>
  
  <pre><code>#x axis
  xt1 =  secondary_system1[0] - primary_system1[0]           
  xt2 =  secondary_system2[0] - primary_system2[0]
  xt3 =  secondary_system3[0] - primary_system3[0]
  xt4 =  secondary_system4[0] - primary_system4[0]
  
  xt = (xt1+xt2+xt3+xt4)/4    #averaging
  </code></pre>
  
  <p>...and so on for y and z axis</p>
  
  <pre><code>#y axis
  yt1 =  secondary_system1[1] - primary_system1[1]           
  yt2 =  secondary_system2[1] - primary_system2[1]
  yt3 =  secondary_system3[1] - primary_system3[1]
  yt4 =  secondary_system4[1] - primary_system4[1]
  
  yt = (yt1+yt2+yt3+yt4)/4    #averaging
  
  #z axis
  zt1 =  secondary_system1[2] - primary_system1[2]           
  zt2 =  secondary_system2[2] - primary_system2[2]
  zt3 =  secondary_system3[2] - primary_system3[2]
  zt4 =  secondary_system4[2] - primary_system4[2]
  
  zt = (zt1+zt2+zt3+zt4)/4    #averaging
  </code></pre>
  
  <p>So above I attempted to calculate average translation vector for every axis</p>