I have a given rectangle that I need to transform into a given quadrilateral shape that resulted from a rotation and translation in 3D space, and subsequent projection.

*---------*        *---------*
|         |  -->   \         /
|         |         \        / 
*---------*          *------*

I only have the coordinates of the projected rectangle (i.e. the four coordinates of the quadrilateral's corners). I need to get back to the 3D rotation and translation that resulted in that projected shape.

Is there a simple mathematical formula that would enable me to compute the values of the rotation vector, rotation angle and translation vector?


  • $\begingroup$ Well, if it's true mathematical projection, it will always end up being a parallelogram, and how far up the z-axis you translate it will not be visible. Also, it's neccesary to know something about the rectangle you started with, like it's the smallest possible, given the result, or something like that. $\endgroup$
    – Arthur
    Mar 2, 2012 at 20:40
  • $\begingroup$ It's a perspective projection, so it's not a parallelogram. About the rectangle, we can make it any size or shape we want (as long as it's a rectangle). $\endgroup$
    – KPM
    Mar 2, 2012 at 20:54
  • $\begingroup$ See dl.dropbox.com/u/7558464/Projection%20example.png for an example. We need to map a picture into the blue-green shape. $\endgroup$
    – KPM
    Mar 2, 2012 at 21:00
  • $\begingroup$ Your answer might lie in the functions of this tulrich.com/geekstuff/canvas/perspective.html $\endgroup$
    – user822711
    May 17, 2012 at 17:01
  • $\begingroup$ Have you looked into plane-to-plane "homographies" (en.wikipedia.org/wiki/Homography)? $\endgroup$
    – B0rk4
    Aug 17, 2012 at 2:03

1 Answer 1


In this answer, it is described how to construct a perspective transform $M$ that maps the any quadrilateral to any other quadrilateral.

Once $M$ is computed, it can be decomposed into a standard $2\times2$ transform $$ \begin{bmatrix}a&b&0\\c&d&0\\0&0&1\end{bmatrix} $$ a translation $$ \begin{bmatrix}1&0&0\\0&1&0\\h&k&1\end{bmatrix} $$ and rotations on the $x$ and $y$ axes $$ \begin{bmatrix}1&0&0\\0&\cos(\theta)&\sin(\theta)\\0&0&1\end{bmatrix} \quad\text{and}\quad \begin{bmatrix}\cos(\phi)&0&\sin(\phi)\\0&1&0\\0&0&1\end{bmatrix} $$ to give the $3$D motions equivalent to $M$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .