Skip to content

Commit

Permalink
orbitalkiller: added orbitalVelocityByTrueAnomalyRad as a common meth…
Browse files Browse the repository at this point in the history
…od for ellipse and hyperbolic orbits
  • Loading branch information
Andrey Borunov committed Jun 21, 2016
1 parent 8186a09 commit 5596ff1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Expand Up @@ -211,7 +211,7 @@ object OrbitalKiller extends ScageScreenAppDMT("Orbital Killer", property("scree
}
)

val moon_start_position = DVec(-269000000, 269000000)
val moon_start_position = earth.coord + DVec(0,1).rotateDeg(270)*380000000l
val moon_init_velocity = satelliteSpeed(moon_start_position, earth.coord, earth.linearVelocity, earth.mass, G, counterclockwise = true)
val moon = new Planet(
ScageId.nextId, "Луна",
Expand Down Expand Up @@ -277,9 +277,9 @@ object OrbitalKiller extends ScageScreenAppDMT("Orbital Killer", property("scree
//val ship_init_velocity = moon.linearVelocity + (ship_start_position - moon.coord).p*moon.groundSpeedMsec/*DVec.zero*//*satelliteSpeed(ship_start_position, earth.coord, earth.linearVelocity, earth.mass, G, counterclockwise = true)*1.15*/
//val ship_init_velocity = -escapeVelocity(ship_start_position, earth.coord, earth.linearVelocity, earth.mass, G, counterclockwise = true)*1.01

// на орбите в 1000 км от поверхности Луны
val ship_start_position = moon.coord + DVec(0, moon.radius + 100000)
val ship_init_velocity = speedToHaveOrbitWithParams(ship_start_position, 900000, moon.coord, moon.linearVelocity, moon.mass, G, ccw = true)//satelliteSpeed(ship_start_position, moon.coord, moon.linearVelocity, moon.mass, G, counterclockwise = false)
// на орбите в 100 км от поверхности Луны
val ship_start_position = moon.coord + DVec(0, 1).rotateDeg(90)*(moon.radius + 100000)
val ship_init_velocity = speedToHaveOrbitWithParams(ship_start_position, 0, moon.coord, moon.linearVelocity, moon.mass, G, ccw = true)//satelliteSpeed(ship_start_position, moon.coord, moon.linearVelocity, moon.mass, G, counterclockwise = false)
//val ship_init_velocity = satelliteSpeed(ship_start_position, earth.coord, earth.linearVelocity, earth.mass, G, counterclockwise = true)*1.15

// на гиперболической орбите Земли, приближаемся к перицентру, летим по часовой стрелке
Expand All @@ -293,7 +293,7 @@ object OrbitalKiller extends ScageScreenAppDMT("Orbital Killer", property("scree
val player_ship = new Ship4(ScageId.nextId,
init_coord = ship_start_position,
init_velocity = ship_init_velocity,
init_rotation = 90
init_rotation = 180
)

// на круговой орбите в 200 км от поверхности Земли
Expand Down
Expand Up @@ -1235,6 +1235,7 @@ package object orbitalkiller {
def tetaRad2PiInPoint(p:DVec):Double
def distanceByTrueAnomalyRad(angle_rad:Double):Double
def orbitalVelocityValueByTrueAnomalyRad(teta_rad: Double):Double
def orbitalVelocityByTrueAnomalyRad(teta_rad: Double, ccw:Boolean):DVec
def orbitalPointAfterTime(point1: DVec, time_msec: Long, ccw: Boolean): DVec
def withNewFocusPosition(new_f:DVec):KeplerOrbit
def orbitalPointInPoint(p:DVec):DVec
Expand Down Expand Up @@ -1762,6 +1763,10 @@ package object orbitalkiller {
math.sqrt(mu * (2 / r + 1 / a))
}

def orbitalVelocityByTrueAnomalyRad(teta_rad: Double, ccw:Boolean):DVec = {
orbitalVelocityInPoint(orbitalPointByTrueAnomalyRad(teta_rad), ccw)
}

def orbitalVelocityByDir(dir: DVec):Double = {
orbitalVelocityValueByTrueAnomalyRad(tetaRad2PiByDir(dir))
}
Expand Down

0 comments on commit 5596ff1

Please sign in to comment.