Welcome, Guest. Please Login or Register
Home Help Search Login Register
Page Index Toggle Pages: 1
Send Topic Print
Ultimate SUN position math (Read 8800 times)

Posts: 1726
Ultimate SUN position math
01/22/07 at 00:33:12
Hello. I have to admit that my SUN math was all screwed up. Now here is finally the true scientific way.

Check out this page:  http://mathworld.wolfram.com/SphericalCoordinates.html

What we have are UV coordinates on that sphere, turning it into a carthesian coordinate system.
First thing is to convert the UV into Theta and Phi.

Our SunU is their Theta. SunU goes 0...1, Theta goes 0...2PI.
A simple remapping will do. In LW I have to shift it halfway round, so I end up with

       theta = (SunU + 0.5)*PI*2;

Same goes for Phi.   SunV goes 0...1, Phi goes 0...PI
This is straight forward:

       phi = SunV*PI;

And now, the page lists the formulas for carthesian coordinates. Make sure to check their axis orientation on the figure drawing, and swap out the according variables.

In LW, the Y axis goes up, and it's also reversed from the drawing, my adaption looks like this:

       z = cos(theta) * sin(phi) * -1;
       x = sin(theta) * sin(phi) * -1;
       y = cos(phi);

That should get you running... Good luck!


Back to top
IP Logged
Ex Member

Reply #1 - 01/24/07 at 00:03:48
OH NO!!!!!!
Back to top
IP Logged
Ex Member

Re: Ultimate SUN position math
Reply #2 - 02/27/07 at 23:37:46
I gave the "scientific way" a try but while it gave me good results on some sdrs it seemed very awkward on others. So I was wondering whether the creators of some SDRs might post side- and front - screenshots with the sun light and provide the rotate values. So it would be easier to get this formula to work in other environments, too, because I think itīs quite hard if you donīt know which solution to expect. What do you think?
Back to top
IP Logged
Page Index Toggle Pages: 1
Send Topic Print