Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement - Geocentric Horizon view / CelestialSphere of universe based off user location + date #46

Closed
johndpope opened this issue Nov 17, 2017 · 16 comments

Comments

@johndpope
Copy link

johndpope commented Nov 17, 2017

I've spent some days digging through this - with this image - hopefully it will make sense.
https://youtu.be/9XHoVF2G0j8?t=653

http://astro.unl.edu/classaction/animations/coordsmotion/celestialhorizon.html

screen shot 2017-11-16 at 20 36 41

I think I'm looking to find a camera angle for scenekit which would create a horizon view to universe
I want to make the point of view geocentric.
the horizon which is currently the heliocentric plane - I want to tilt to the declination of earth's orbit - with every planet above the horizon above the scenekit floor / everything below the earth beneath. the universe plane would still spin as it does. (I'm not looking to create star walk - how the view is represented is perfect. )

Not sure how hard this is - I found this function that maybe able to be repurposed.
given a users location / instead of finding the moon - perhaps we can derive a camera angle in scenekit. the point of view - would be geocentric - as the user sees the planets above.

func findMoon(date: NSDate, longitude: Double, latitude: Double) -> (Double,Double,Double)
https://github.com/johndpope/Moon/blob/ui-heading-display/Moon/FindMoonService.swift

@johndpope johndpope changed the title Celestial Sphere of universe based off user location + date Celestial Sphere based off user location + date Nov 17, 2017
@johndpope
Copy link
Author

moon app
Optional(<+37.33233141,-122.03121860> +/- 5.00m (speed 0.00 mps / course -1.00) @ 11/17/17, 1:54:18 AM Greenwich Mean Time)
Location Authorized!
date: 6529.57940850267
Ecliptic Long: 219.861644466578
Ecliptic Lat: 4.96158472691399
SET MOON

screen shot 2017-11-16 at 20 54 23

@johndpope johndpope changed the title Celestial Sphere based off user location + date Horizon view of universe based off user location + date Nov 17, 2017
@johndpope johndpope changed the title Horizon view of universe based off user location + date Enhancement - Geocentric Horizon view of universe based off user location + date Nov 17, 2017
@johndpope
Copy link
Author

screen shot 2017-11-17 at 2 48 15 pm
screen shot 2017-11-17 at 2 48 10 pm
https://github.com/op1000/EarthTravel/blob/master/movie/movie_ani.mov

these objective-c classes successfully map the lat / lng co-ordinates to an object in scenekit.
https://github.com/op1000/EarthTravel/tree/master/EarthTravel/Classes

@johndpope
Copy link
Author

fyi - @onekiloparsec

@johndpope
Copy link
Author

johndpope commented Nov 18, 2017

I apologize for confusion as the words to describe what I want to do fail me. I need to do a drawing.
I don't have photoshop at my disposal right now either.
Also - I only found out today that there's such a thing called galataticLatitude and galaticLongitude.

so let me clarify this ticket - using CoreLocationManager - I can easily find true north as shown above from where I am. That's all easy stuff. This code goes one step further and indicates where the moon is in relation to the user.
https://github.com/johndpope/Moon/blob/ui-heading-display/Moon/ViewController.swift

Not sure how to do the translation of the view - but if we can get the sun to align to the sun,
so above where it says Manama - imagine that is zoomed to street level - it's day time, I can see the sun at 12 o'clock - the arkit would have the sun above the planet earth correctly aligned to today's date. I say street level but as app works at the moment - being able to pinch zoom out of state / country level would shrink the universe onto a table top which is exactly what I'm trying to do but respecting where the planets / moon / sun is with respect to user's location.

That is the universal plane with planets would tilt accordingly to where they're actually spinning with respect to end user's location + date. This is called geocentric point of view.

I reached out to the author of SwiftAA - Cédric Foellmi and he mentioned

At a fixed given point in time (assuming you keep standard epoch and equinox, of course…), you still have to take care of Earth location, and make sure you check the (small) difference between geocentric (with Earth center as reference) and topocentric (Observer position as reference) positions.

I think to do this - need to break apart into smaller tickets - so I added the ability to add lat / lng position according to scenekit node in other ticket.

From digging into celestial spheres - I think this is what should be in place of the sun.

Perhaps - a worthy SwiftAA side piece of work would be to create some code that can create a celestial sphere in arkit this would match up to user's current location and compass baring.
screen shot 2017-11-17 at 7 56 38 pm

I dug into flash animate code / but it's actionscript 1. bin job.
http://physics.unl.edu/~astrodev/flashdev2/celestial_sphere/celestial_sphere101.html

screen shot 2017-11-17 at 8 25 54 pm

This image is only helpful in that it helps illustrate a person inside sphere - that would align to earth's rotation / user's north. all the planets would fly around it using arkit.

@johndpope johndpope changed the title Enhancement - Geocentric Horizon view of universe based off user location + date Enhancement - Geocentric Horizon view / CelestialSphere of universe based off user location + date Nov 18, 2017
@johndpope
Copy link
Author

johndpope commented Nov 18, 2017

fyi - rotate earth to right time of day / scenekit + swift
gavineadie/Geometries@7e35351

screen shot 2017-11-17 at 9 07 30 pm

@gavineadie
Copy link

That's a quite old version of my "Geometries" testbed!
I'll bring it up to date so it actually looks like what it's meant to!

@johndpope
Copy link
Author

img_2091
thanks @gavineadie for updating code base.
I found this very simple gryoscope / coremotion + scenekit code.
https://github.com/mike-ferenduros/gyrotest/blob/master/gyrotest/GyroViewController.swift

instead of the cube - I will rework it to be planet earth. the top being current location.
need to add a zenith point reflecting top of celestial sphere.

@johndpope
Copy link
Author

some progress - https://github.com/johndpope/solarSystem-1
this hooks into coremotion - and rotates scenekit nodes according to orientation of phone.
it's currently rigged up to the sun. It's using a different code base to AugmentedSolarSystem - but currently code is simpler while I work out logic. for the geocentric view to work / I need to be able to determine the sidereal / altitude / azimuth - onekiloparsec/SwiftAA#74

Not sure what' necessary from scenekit - but I need the elliptical planes to be gymbal locked to earth. Currently in my code - when I rotate the sun - the planets continue merrily along their previous paths. when I adjust the earth, I need all the planets to adjust their planes accordingly.

@onekiloparsec
Copy link

onekiloparsec commented Nov 20, 2017

Similarly to coordinates conversion, obtaining the sidereal time is just a matter of converting the date (or JulianDay) to sidereal time, using the geographic coordinates. See the method meanLocalSiderealTime in the JulianDay struct/extension.

@johndpope
Copy link
Author

maths for calculating geocentric position of planets.
http://www.stjarnhimlen.se/comp/tutorial.html#14

@johndpope johndpope reopened this Nov 23, 2017
@onekiloparsec
Copy link

Still, SwiftAA provides everything you need to make these calculations. Probably with more accuracy than this web page.

@johndpope
Copy link
Author

I believe SwiftAA needs an orrery for reference purposes
/ maybe using scenekit / arkit or metal
maybe augmented reality - maybe without.

this seems to be the flagship
http://mgvez.github.io/jsorrery/

https://github.com/mgvez/jsorrery/tree/master/src/algorithm

@johndpope
Copy link
Author

johndpope commented Nov 26, 2017

I want to build something like this app Cosmic Watch - it's superb.
img_2137

img_2134

@johndpope
Copy link
Author

johndpope commented Dec 3, 2017

so digging through docs on swiftAA - the class Planet supposedly includes equatorialCoordinates.
if somehow the planets in scenekit shared the logic of the respective Planet node then perhaps we can tap into this variable to determine the position. Would need to translate between the two.

/// The coordinates of the object in the equatorial system (based on Earth equator), with the Earth's center as its origin.
    public var equatorialCoordinates: EquatorialCoordinates {
        get { return self.apparentGeocentricEquatorialCoordinates }
    }

    /// The heliocentric coordinates of the planet in the ecliptic system (based on planet orbits plane). That is, its apparent position on the celestial sphere, as
    /// as it would be seen by an observer at rest at the barycenter of the solar system, and referred to the 
    /// instantaneous equator, ecliptic and equinox.
    /// It accounts for 1) the effect of light-time and 2) the effect of the Earth motion. See AA p224.
    public var heliocentricEclipticCoordinates: EclipticCoordinates {
        get {
            let longitude = KPCAAEclipticalElement_EclipticLongitude(self.julianDay.value, self.planet, self.highPrecision)
            let latitude = KPCAAEclipticalElement_EclipticLatitude(self.julianDay.value, self.planet, self.highPrecision)
            // Using standard epoch, thus standard value for the equinox, thus the mean obliquity.
            return EclipticCoordinates(lambda: Degree(longitude), beta: Degree(latitude))
        }
    }

@johndpope
Copy link
Author

johndpope commented Dec 3, 2017

I think for me to get this working - need to take a step back and build an armillary sphere - then drop it into ARKit.

520x293bb 3

520x293bb

ITunes App
https://itunes.apple.com/nz/app/armillary-sphere/id1225026601?mt=8

img_a562217f2e80-1

@johndpope
Copy link
Author

johndpope commented Dec 3, 2017

https://vimeo.com/55019500

screen shot 2017-12-02 at 9 29 29 pm

Exactly the angle I want to view the earth
screen shot 2017-12-02 at 9 30 03 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants