title: How do I convert a coordinate in one 3d Cartesian coordinate system to another 3d Cartesian coordinate system
body: <p>I start with one coordinate system and a point along the Z axis given by P1 = [0 0 h]
  and a point in the XY plane given by P2 =  [h*tan(A), h*tan(B), 0]
  I then solve for the equation of a plane perpendicular to a vector which points from  P2 to P1 so, Vector = P1 - P2. The Plane equation I get is the following:</p>
  
  <p>X*h*tan(A)-Y*h*tan(B)+Z*h = 0.</p>
  
  <p>Now I am given four points relative to this plane, from which the origin of this new plane is the same as P2 in the original plane.</p>
  
  <p>The four points make a rectangle and are:</p>
  
  <pre><code>[L*tan(C), L*tan(D), 0]
  [L*tan(C), -L*tan(D), 0]
  [-L*tan(C), -L*tan(D), 0]
  [-L*tan(C), L*tan(D), 0]
  </code></pre>
  
  <p>How exactly would I go about converting these points into the original coordinate system?
  I know that there's a translation and a rotation involved, and when I goggled my problem I could only find cases of translation and rotation separate, and none which were a combination of the two. </p>
  
  <p>How exactly does the rotational transformation work? What if i already know it rotates about the X axis by A degrees and about the Y axis by B degrees? Can I then just do simple trig in that case to back track the value? Or is it not that simple and I have to rotate it about the axis it has to rotate in order to match back to the original coordinate system?</p>
  
  <p>Is there a function in MATLAB to which i can insert say 3 points which define one coordinate system and another 3 points for a second coordinate system that would then give me the transformation matrices?</p>
  
  <p>Please let me know if my wording is unclear, this 3-D problem is so very hard to visualize I can't seem to figure out how to write all the trig for it and wanted to try it mathematically... but If you by chance know a more simple solution which mgiht be more straight forward please suggest it!</p>