ThumbWorks / AugmentedSolarSystem

An Augmented reality experience to explore planets in our Solar System
70 stars 25 forks source link

Investigate lines / trails of planet paths - #58

Open johndpope opened 6 years ago

johndpope commented 6 years ago

https://github.com/Stellarium/stellarium/blob/ff2e4e253a57ee0da3b5279fe91904a2d160cb13/src/core/modules/GridLinesMgr.cpp

johndpope commented 6 years ago

https://github.com/UgolUgol/ARHome/blob/bd41f7e087ae05b33ce278a330b4ddd7202477d8/ARHOME112/Orbit.swift

screen shot 2018-03-09 at 3 13 25 pm

orbits with eccentricity / elliptic curves

// add one trajectory point of planet to scene
    func addTrajectoryPoint(position: SCNVector3){

        // check planet finished one full rotation cycle
        if(self.time == 0.0){
            self.orbit.isTrajFinish = true
        }

        // if one cycle is not finished
        // add point to scene
        if(!self.orbit.isTrajFinish){
            self.orbit.updateTrajectory(planetPosition: self.position)
        }
    }

    // make one rotation step on V angle
    func rotationStep(position: SCNVector3, scale: Float!){

        // rotation time moment
        self.time = (self.time + self.dt) <= self.T ? self.time + self.dt : 0.0

        // find the angle E(t) solving kelper eq with Halleys method
        // after it find true anomaly v(E, t)
        var newPosition = SCNVector3()
        self.M = self.n * self.time
        self.E = methodHalleys()
        self.v = trueAnomaly()

        // set new position to move
        newPosition.x = self.orbit.x(angle: self.v) / scale
        newPosition.y = position.y
        newPosition.z = self.orbit.z(angle: self.v) / scale

        // speed calculation
        speedAtPoint(r: self.orbit.r(angle: self.v))

        // move to new position
        self.position = newPosition
    }