KSP-0.1: A library with the kerbal space program universe and demo code

Description

Synopsis

# Documentation

`getNextUp` takes a `KSystem` system and a `Body`. It returns the body that the supplied body orbits. `Nothing` is returned if the supplied body is not found within the system.

getPathUp :: KSystem Body -> Body -> [Body] Source

`getPathUp` takes a `KSystem` system and a `Body`. It returns the chain of body's that are orbiting each other.

getDivid :: KSystem Body -> Body -> Body -> (Int, Body) Source

`getDivid` takes a `KSystem` system and a from `Body` and a to `Body`. For both bodys, the path up is calculated by `getPathUp` and the position, where they reach the same body is returned (as Position and with the actual body).

`sOrbitInSystem` takes a body, a `KSystem` system and maybe returns the orbit of the body.

pathOBetween :: KSystem Body -> Body -> Body -> [(Body, Orbit Body)] Source

`pathOBetween` takes a `KSystem` system and a from `Body` and a to `Body`. If one want's to reach the to body from from body the bodys between and their orbit around their centerBody are returnd.

pathOBetween' :: KSystem Body -> Body -> Body -> ([(Body, Orbit Body)], (Body, Orbit Body), [(Body, Orbit Body)]) Source

`pathOBetween'` takes a `KSystem` system and a from `Body` and a to `Body`. If one want's to reach the to body from from body the bodys between and their orbit around their centerBody are returnd. They are returnd as triple, with the overlapping body in the center of the triple and the path of the from body in the first element of the triple. The path of the to body in the last element of the triple.

pathBetween_ :: KSystem Body -> Body -> Body -> [Body] Source

`pathBetween_` takes a `KSystem` system and a from `Body` and a to `Body`. If one want's to reach the to body from from body the bodys between are returnd, without the common body.

pathBetween' :: KSystem Body -> Body -> Body -> ([Body], Body, [Body]) Source

`pathBetween` takes a `KSystem` system and from `Body` and a to `Body`. If one want's to reach the to body from from body the bodys between and their orbit around their centerBody are returnd. They are returnd as triple, with the overlapping body in the center of the triple and the path of the from body in the first element of the triple. The path of the to body in the last element of the triple.

pathBetween :: KSystem Body -> Body -> Body -> [Body] Source

`pathBetween` takes a `KSystem` system and a from `Body` and a to `Body`. If one want's to reach the to body from from body the bodys between are returnd, including the common body.

pathSpeeds :: [(Body, Orbit Body)] -> [Speed] Source

`pathSpeeds` takes the result of `pathOBetween` and calculates the corresponding orbital speeds.

`orbitalSpeed` returns the orbital velocity of the given orbit.

`updateOrbit` is a function that takes an orbit and two heights. It updates the apoapsis with the bigger height and the periapsis with the smaller.

`burnProgradeFromCircOrb` calculates the transformed orbit, after the supplied delta V is applied to the initial orbit.

A prograde burn is done through a positive `Speed` parameter, a retrograde burn respective through a negative `Speed`.

burnAt :: (Orbit Body -> Double) -> Orbit Body -> Speed -> Orbit Body Source

`burnAt` calculates the new orbit after a burn of `Speed` delta V is applied to the given orbit.

• `f` is the function that calculates returns the distance of the body within orbit, to the center body. Typical this is one of `apoapsis` or `periapsis`
• `o` is the initial orbit
• `dV` is the amount of delta V to apply to the orbit.

`burnAt` calculates the new orbit after a burn of `Speed` delta V is applied to the given orbit at the apoapsis.

`burnAtPeriapsis` calculates the new orbit after a burn of `Speed` delta V is applied to the given orbit at the periapsis.