sky-map-team / stardroid

Sky Map (formerly Google Sky Map, open sourced in 2012)
https://play.google.com/store/apps/details?id=com.google.android.stardroid&hl=en
Apache License 2.0
925 stars 232 forks source link

Change view Direction #129

Open pion3er opened 8 years ago

pion3er commented 8 years ago

I have got a little question about a modification I want to add to my SkyMap code and where I have been struggling for a while.

Actually all I want to do is to change the view direction by 90 degrees. So currently, if I'm pointing e.g. towards western direction with my phone I get shown the view to the western sky as it would be seen by my smartphone camera (the normal standard behaviour).

So the effect of the modification I want to add would be that I'll have to rotate the smartphone by 90 degrees towards the zenith (so the camera is facing zenith and the screen is looking towards nadir) but the screen is (still) showing the scenery like if I was pointing towards the western direction. So it's like a "looking around the corner" modification of the code where the view is rotated by 90 degrees.

Actually I thought this has to be quite simple (just a 90 degrees transformation), but with all the different types of coordinate systems all my attempts were not working properly :-(

I would be glad if you could give me a hint or an idea where this code change could be most easily implemented. (e.g. Changing some static variable like POINTING_DIR_IN_PHONE_COORDS etc...)

Regards

pion3er

jaydeetay commented 8 years ago

Hi Pion3er. Urk...even to me the code is somewhat impenetrable after 6 years. However, I think I can figure this out. A word of caution though - this part of the code is getting a few changes as we plumb in the gyroscope. Longer term I'm hoping to drastically simplify it since the Android APIs can now do much of the work we had to do on our own back in Android 1.5.

Let me take a look...

barbeau commented 8 years ago

I took a look at the coordinate systems involved a few years ago, as I was planning on borrowing code to do an augmented reality view in GPSTest. My notes are here, in case they are helpful: https://github.com/barbeau/gpstest/issues/12

jaydeetay commented 8 years ago

Thanks Sean! Pion3er - I think you basically had it. This vector: private static final Vector3 POINTING_DIR_IN_PHONE_COORDS = new Vector3(0, 0, -1);

defines the line of site in the phone's coordinate system (which has Z coming out of the screen, hence -1 in the vector). You want to show on the screen what the bottom of the phone is pointing to, so I think if you change the vector to (0, -1, 0) it will work. You also need a second vector which defines the rotation of the screen around that axis. In the current code it's (0, 1, 0) (up along the screen). I think if we rotate everything around the phone x-axis this will change to (0, 0, -1). If it doesn't work try (0, 0, 1) (I'm too jetlagged today to think straight!).

jaydeetay commented 8 years ago

By line of site, I meant line of sight. English is even more of a challenge than geometry today.

pion3er commented 8 years ago

Hey John and Sean! Thanks very much for your help! That's the solution I was looking for.

Regards

pion3er

JPhilC commented 4 years ago

Hi there,

Did this every make it into the released product. With the lock down I have noticed a large increase in the number of people buying their first telescope. Often a 6 or 8" dobsonian. If they could strap their phone to the OTA tube skymap could be used to guide them into the correct area of the sky.

Regards,

Phil

jaydeetay commented 4 years ago

Sorry I missed this (months ago!) - no I don't believe we've implemented this. However I think it would be reasonably easy to do - we already have a feature to rotate the view 90 degrees around the axis coming in/out of the phone (I think we did it to support tablets that are fixed in landscape mode). I'll take a look and see how hard this would be.

Isn't it funny how certain products have become hot commodities? I was thinking of buying a telescope myself...

On Wed, May 20, 2020 at 9:25 AM JPhilC notifications@github.com wrote:

Hi there,

Did this every make it into the released product. With the lock down I have noticed a large increase in the number of people buying their first telescope. Often a 6 or 8" dobsonian. If they could strap their phone to the OTA tube skymap could be used to guide them into the correct area of the sky.

Regards,

Phil

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sky-map-team/stardroid/issues/129#issuecomment-631471633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5LWC32FCMQNRAW2BVHY6TRSPK3DANCNFSM4CIR4XTQ .