Viewing the on-screen map
I'm writing an on-screen map viewer, all I've found so far is projection, conversions and inverse which is the easiest part.
I don't want to use OpenGL or DirectX text solutions, I want to draw image pixel by pixel. The only problem I am having is transforming the view camera rectangle.
I mean, I have a rectangle through which the viewer shows equivalent pixels on the map. When the viewer looks up or down, or left or right, this view changes, but the changes are not linear, even in a spherical coordinate system. Since the dimensions of the rectangle must remain constant in the Cartesian sense, otherwise we will have a deformation.
Can anyone tell me how to fix this problem? A good doc link or a hint of where I start is all I need. Thanks in advance.
source to share
Ok, no one answered this and I figured it out. There are two "practical" solutions, first, using quaternions. You can define a 3d rectangle as a representation and then rotate it using quaternions. After that, you can loop through the resulting rectangle and use inverse transformations to get the map coordinates. Another solution that seems faster to me is using Euler's rotation matrices. Just note to use ArcTan2 instead of ArcTan because you need 2 * PI coverage. That's all I wanted!
source to share