# Matrix for transforming a square to a quadrilateral

I have a square of points {<0, 0, 0>, <6, 0, 0>, <6,0, 6>, <0,0,6>} (The square is placed at the origin in the xz plane in opengl).

Want to apply a transformation/s on the square and make a quad whose points are {<-0.156712, -0.010205, 1.392891>, <-0.025491, -0.054014, 1.602598>,<0.097527, -0.026609, 1.470910>, <-0.033522, 0.014052, 1.301813>}

How would the transformation matrix be derived?

• I'm pretty sure you'll have to solve an equation system with 5-9 variables. Also, I haven't checked but if those vertices are just random points, there might be a possibility, that the original vertices can't be transformed into them with a simple matrix. Mar 20, 2019 at 7:01
• They are not random points Mar 20, 2019 at 7:05
• Basically, read this: matesfacil.com/english/high/… I'll try to write an answer later today Mar 20, 2019 at 7:08
• Nevermind, just do this: math.stackexchange.com/questions/557507/… the second answer is better in this case Mar 20, 2019 at 10:38