Skip to content

Investigate lines / trails of planet paths - #58

Open

Activity

  1. johndpope commented on Mar 9, 2018

    @johndpope
    Author

    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
       }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions