How can I change my viewpoint within a celestial sphere in planetarium software?

  • Thread starter Thread starter djbog
  • Start date Start date
  • Tags Tags
    Astronomy
AI Thread Summary
The discussion focuses on adjusting the viewpoint within a celestial sphere in planetarium software. The user initially struggles with changing the altitude of their viewpoint while maintaining accurate altitude and azimuth coordinates for celestial objects. They eventually solve the problem by converting the coordinates into Cartesian (xyz) format and applying rotational transformations. The importance of the order of these transformations is emphasized, as it significantly affects the outcome. The user expresses gratitude for the assistance received, highlighting the effectiveness of their new approach.
djbog
Messages
2
Reaction score
0
Hi, I couldn't decide whether this was more maths or more astronomy, but I settled for maths. Sorry for the long description, I think the answer is quite simple, and I'm making a meal of it!

I am currently writing some planetarium software for use on my website. I have calculated the Alt/Az of lots of objects, and used the conversion to spherical polars to plot them onto a cartesian xy plane (the screen!) with r=1. For those of you who are not sure, Alt is the altitude of the object above the horizon (0-90 deg) and Az is the azimuth (0-360 deg) measured East from North. The zenith (directly up) is at (0,0).

This all works fine. My problem is that I want to move my viewpoint around within the 'celestial sphere'. I can zoom in and out with no problem, and I can add small amounts to the the Azimuth of each object in order to rotate the 'sky'. What I cannot do is change the Alt of the point at which I am looking, the default is to look straight up at the zenith.

I assume to accomplish this, I need to add or subtract a certain value from the Alt and Az of each object. I cannot get my head around how to do this.

I have attached an image as an example. The circle shows a bottom-up view of a hemisphere. Firstly my viewpoint is centered on the zenith (0 deg, 0 deg). Here, A is at (20 deg, 0 deg) B is at (20 deg, 90 deg) C is at (20 deg, 180 deg) and D is at (20 deg, 270 deg). If I was to move my viewpoint to X (10 deg, 0 deg), then clearly A would become(10 deg, 0 deg) and C would be (30 deg, 180 deg). How would I find the apparent Alt/Az of B and D, and is there a generalised form of this that I could use using any offset to any initial position?

I might be making this much harder than it actually is, so if you can help or you have any questions, please give me a shout.
 

Attachments

  • mths help.jpg
    mths help.jpg
    16.3 KB · Views: 388
Mathematics news on Phys.org
djbog said:
I assume to accomplish this, I need to add or subtract a certain value from the Alt and Az of each object. I cannot get my head around how to do this.

If your initial position is the zenith (your line of sight?), you would have to subtract some value. You would also have to specify an azimuth direction in accordance, so that you know which of the infinitely many directions that you desire for your new line of sight. It's like standing exactly on the north pole of the earth.

djbog said:
I have attached an image as an example. The circle shows a bottom-up view of a hemisphere. Firstly my viewpoint is centered on the zenith (0 deg, 0 deg). Here, A is at (20 deg, 0 deg) B is at (20 deg, 90 deg) C is at (20 deg, 180 deg) and D is at (20 deg, 270 deg). If I was to move my viewpoint to X (10 deg, 0 deg), then clearly A would become(10 deg, 0 deg) and C would be (30 deg, 180 deg). How would I find the apparent Alt/Az of B and D, and is there a generalised form of this that I could use using any offset to any initial position?

When you change coordinates to A and say that the other coordinates are changing, you are talking about the "relative" coordinates to your line of sight; the Alt/Az coordinates should not change value at all unless you have moved to a new location on Earth or a significant time interval has passed.

It's really difficult for me to say anything else. I'm not familiar with your program. Do you have a workable version currently online? What portion of the sky is visible in your program, a small-portion or the whole local sky? Does your program permit the user to change locations on Earth or viewing time?
 
Last edited:
Hi, just a note to say that I solved (well got around!) this problem, by converting everything into Cartesian (xyz) coordinates, then applying the transformations that can be seen in the attached image. I found these formula in an old games programming book, and I even though this clearly isn't the native coordinate system of astronomy, I actually understand it, so it makes it a great deal easier for me to work with.

Alpha, beta and gamma refer to rotations around the z, x and y-axis respectively. Remember that the order that you do them in makes a huge difference to the outcome!

Thank you for your response, If I hadn't have done it this way I may well have been working with you to figure it out.
 

Attachments

  • equation.jpg
    equation.jpg
    7 KB · Views: 385
Seemingly by some mathematical coincidence, a hexagon of sides 2,2,7,7, 11, and 11 can be inscribed in a circle of radius 7. The other day I saw a math problem on line, which they said came from a Polish Olympiad, where you compute the length x of the 3rd side which is the same as the radius, so that the sides of length 2,x, and 11 are inscribed on the arc of a semi-circle. The law of cosines applied twice gives the answer for x of exactly 7, but the arithmetic is so complex that the...
Back
Top