r/GraphicsProgramming • u/[deleted] • Mar 26 '21
Rotating a quad
Really noob question, but I'm really bad at math so can somebody explain how can I rotate a quad around its x, y or z axis?
0
Upvotes
r/GraphicsProgramming • u/[deleted] • Mar 26 '21
Really noob question, but I'm really bad at math so can somebody explain how can I rotate a quad around its x, y or z axis?
3
u/[deleted] Mar 26 '21
The transformation is quite simple.
The basic idea of it is to apply the transformation to each vertex. You rotate a vertex around the center. The formula is similar to the 2D rotation except that the 3rd coordinate would remain unchanged which depends on the axis of rotation.
You seem to be new to graphics so I would suggest familiarising with concepts such as model transformation matrices which essentially combines translation, scaling and rotation to one matrix which can be multiplied to each vertex to get the desired transformation.
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/