# Stargazing Stars in sky given arbitrarily sized/oriented window

1. Jul 15, 2016

### Phil A

Hi All,
I've been taking a bit of a crash course in astronomy for a raspberry pi project I'm toying with. I basically want to create a window to the night sky without the actual window but a screen to replace it. Barring the practicality (psh, who needs that) of doing this, it's been a lot of fun learning all this stuff.

I've gotten to the point where given any lat/lng and time, I can calculate all the stars in the night sky from horizon to horizon. And I think given just a window with a squared up vertical/horizontal orientation, I can also calculate the stars in that range, even if the window moves up in elevation from the horizon.
My math for this is something like:
Assume the observer looking out is in the center of the window and estimate the distance to the window to get the angle of the observer's line of sight relative to the vertical window side. Doubling this (since your observer is centered) creates a range of azimuth angles.
Do something similar but with the horizontal window sides to get your range of elevation angles. Any stars that are within these ranges are visible through the window.

1) Is my math correct for this?
2) Now let's say I were to give the window an arbitrary orientation so that my vertical sides and horizontal window sides are tilted by X degrees, what does my math become then?

If an added visualization is needed, I think this problem is similar to how Star Walk is able to handle my tilting the phone one way or the other. How the heck is it able to calculate what stars are just ahead?

Thanks for any help you can provide!

2. Jul 15, 2016

### davenn

Hi there Phil

Welcome to PF

you know there are already quite a number of phone apps that do this sort of thing ?

Stellarium, Heavens Above ... to name a couple

cheers
Dave

Last edited: Jul 15, 2016
3. Jul 15, 2016

### Phil A

Hi davenn,
Thanks for the response! And yep, Star Walk does this as well and was probably a seed of inspiration for the project, but that doesn't stop me from wanting to implement it myself. I think the problem is I don't even know what to google for or what branch of mathematics to start reading up on. Even some direction there would probably be very helpful.

4. Jul 15, 2016

### QuantumQuest

I think that some decent knowledge of undergrad math (Linear Algebra, Trigonometry, Calculus) along with some spherical trigonometry is a good start. I recommend an old book I've already studied named Spherical Astronomy by W.M.Smart. You can download it from archive.org: https://archive.org/details/SphericalAstronomy. As davenn pointed out, there are already quite a number of apps out there - I have Stellarium on my desktop and I think, it would be a good idea to become sufficiently acquainted with some well established app before you make your own. You can see what it offers in detail and maybe discover or anyway understand some additional things, that you may want to incorporate to your app.

5. Jul 15, 2016

### Staff: Mentor

I guess I'm confused about what the problem is: if you've already "calculate[d] all the stars in the night sky", then you are basically already finished setting-up the math. You just need a different cutoff to your sky globe than you are using (a small window instead of half the sky).

6. Jul 15, 2016

### Phil A

Sorry for any confusion, let me try to clarify. Also, if this isn't the right forum for this, let me know. It starting to feel like it might actually be a graphics programming problem.

Let's say I have a rectangular window sitting at 45 degrees elevation. The bottom and top "frames" of the window are parallel with the plane of the horizon. Using the azimuth and elevation, I believe it's fairly easy to tell what stars are visible through the window, as described in the first post. Now, let's say there's an invisible centerline from an observer to the stars, halfway between the vertical sides and the horizontal sides, and we rotate that window by 20 degrees about the centerline, I'm no longer sure how to tell what stars are visible through the window.

My eventual goal if I can get past the technical stuff is to be able to map the brightest stars to a matrix of LEDs and I'd like to be able to arbitrarily place that anywhere. It will most likely be at a vertical/horizontal orientation but for the completionist in me, I'd like to understand how the math changes when I rotate it about the centerline axis and ideally implement that as well.

Edit: I've been using the word elevation, but I think most people call it altitude. I'm still getting the hang of the nomenclature.

Last edited: Jul 15, 2016