Question

I'm writing an equirectangular map viewer, all the stuff I have found so far are about the projection, conversions and inverse ones, which is the easiest part.

I don't want to use OpenGL or DirectX sphere texture solutions, I want to draw the image pixel by pixel. The only problem I have is in transformation of the viewer's camera rectangle.

I mean, I have a rectangle through which the viewer shows the equivalent pixels on the map. When viewer looks up or down, or left or right, this view changes, but the changes are not linear, even in a spherical coordination system. As the rectangle's dimensions should kept constant in a Cartesian sense, otherwise we will have a deformation.

Can anyone tell me how to solve this problem? A link to a good document, or a hint to where I start is all that I need. Thanks in advance.

Was it helpful?

Solution

Ok, nobody answered it, and I figured it out. There are two "practical" solutions, first one is using the Quaternions. You can define a 3d rectangle as a view and then rotate it using quaternions. After that you can sweep on the resulting rectangle, and use the reverse transforms to get the map coordinates. The other solution, which seems faster to me, is using Euler's rotation matrices. Just pay attention to use ArcTan2 instead of ArcTan function, because you need 2*PI coverage. That's all I wanted!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top