Hi,
This seems inherently a simple task, but I'm having real problems with it!
I have a plane, let's call it P, with its direction defined by its normal vector n, and the camera distance, d, both of which I know:
Upon P, lie a set of coordinates:
I need to rotate these coordinates onto the x-y plane to give a top-down view. I can't move the camera - it's fixed.
My initial attempt was to work out the rotation angles from the normal (x-rotation = phi, y-rotation = theta and z-rotation = psi):
I could then do:
(where (xi,yi,zi) is each coordinate in C).
For some reason, this worked sometimes, but other times the angle was completely wrong!
So I tried something else. When the P is rotated to align with the x-y plane we have:
And we know the combined x-y-z rotation matrix:
For ease of reading, hereafter we have:
Since we don't know what X' and Y' will be, we only use the bottom row of the rotation
matrix. For three coordinates on the original plane, we then have 3 equations with which
to find phi and theta:
Which gives rise to the linear system
Which we solve using Singular Value Decomposition to get a,b and c (take the last column of the "V" matrix). We can then work out phi and theta:
These values were then subbed into the compound rotation matrix given above, and psi was set to 0 giving R. Finally I multiplied each coordinate by R:
This again, didn't work. Although I'm convinced that in theory it should. Is anyone able to spot any errors I might have made? Or can anyone contribute a different idea? This has taken me the last week of work so any advice is most gratefully received!!!
Thanks!


LinkBack URL
About LinkBacks
