title: Changing 3D coordinate system using Excel
body: <p>I have a cloud of points in my spreadsheet in a certain coordinate system the cloud is in this format:
  <code>
  Name X  Y  Z
  PT1  X1 Y1 Z1
  PT2  X2 Y2 Z2
  PT3  X3 Y3 Z3
  PT4  X4 Y4 Z4
  ...
  PTi  Xi Yi Zi
  ...
  </code>
  I want to use four first points in my list to construct a new coordinate frame and transpose all my points in the new frame.</p>
  
  <p>The new coordinate frame has to be defined as a plane-line-point (or a 3-2-1° transformation as such:</p>
  
  <ol>
  <li>Plane is the best fit plane of (PT1, PT2, PT3, PT4). I know how to construct a plane equation using the excel LINEST formula</li>
  <li>Line / vector Midpoint(PT1-PT2) to Midpoint(PT3-PT4) line / vector is easy to construct in excel</li>
  <li>Point is Midpoint(PT1-PT2).</li>
  </ol>
  
  <p>To summarize the origin (0,0,0) would be at the Midpoint(PT1-PT2). The new X axis would be the vector Midpoint(PT1-PT2) to Midpoint(PT3-PT4). The Y axis would be contained in the plane and perpendicular to X. And Z would be perpendicular to X and Y.</p>
  
  <p>Currently I'm able to find the equations of the Plane, and X, Y, Z axis.</p>
  
  <p>My question is how to construct the transformation matrix based on these parameters and implement it using excel formulas.</p>
  
  <p>Thank you.</p>