I have a game project which is based on augmented reality but I don't want to use any of these library's and plugins out there because they can't do what I want to do after this...etc..
So my question is it is possible to calculate the rotation of a 2D rect in a 3D world? If yes how? If no what should I do?
Illustration images for what I'm thinking of:
The 0 rotation on every axis (x,y,z axis in 2 dimension??)
The 0 rotation in the 3D world
Some rotation in 2D world (which is in 3D --> x70, y10, z30)
rotation 70,10,30 in 2D
rotation 70,10,30 in 3D
So how to calculate the 3D rotation from 2D? Like the AR Games do. How they do this?
As an important pre-requisite, you must know which edges on the unrotated rect correspond to which ones on the rotated one.
Calculate the normals of each rect (A and B) respectively, and compute the quaternion required to rotate from A to B => Q. (This is probably available in Eigen or another game math library)
Calculate the following:
Rotate vector C by Q to obtain a vector F. Rotation by quaternion is another common operation available in most 3D math libraries.
Calculate the quaternion to rotate from F to D - E => P
Calculate the final quaternion R = P * Q, and convert to axis-angles if you like: Wikipedia