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

LicenseCC0
Maintainerfrosch03@frosch03.de
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.KSP.DataConstructors

Description

 

Synopsis

Documentation

data Object Source

An Object is something named.

Constructors

Object 

Fields

name :: String
 

Instances

Eq Object 
Show Object

Make Object an instance of Show

data Celestial Source

The Celestial type defines a celestial object within this library. Every celestial object has

  • r [m] the radius (from the bodys center) in meter
  • m [kg] the mass of the object in kilo gramms
  • soi [m] the sphere of influence of the object in meter
  • system empty or a system of surronding objects.

Constructors

Celestial 

Fields

r :: Double
 
m :: Double
 
soi :: Double
 
system :: System Body Body
 

data Body Source

The Body type is the central data type within the KSP library. It could be either Railed or Movable

  • Railed is everything withing ksp that is a star, a planet or a moon. They are static in their orbits and are therefore called railed.
  • Movable is every other part in ksp, that is physical. Here they include deltaV counter, but are also modelled as celestial objects. Actually in ksp orbits around movable parts arent possible. Anyhow, within this data type such constructs are doable.

Constructors

Railed 
Movable 

Fields

object :: Object
 
celestial :: Celestial
 
deltaV :: DeltaV
 

Instances

Eq Body

Make Body an instance of Equalty

Show Body

Make Body an instance of Show

data Orbit a Source

The 'Orbit a' data type defines an orbit around a central body centerBody.

  • centerBody is the body the orbit is around
  • apoapsis is the height of the heighest point of the orbit
  • periapsis is the height of the lowest point of the orbit
  • inclination is the angle that the orbit is inclined against the aquatorial plane
  • omega_big is the longitude of the ascending node
  • omega_small is the argument of the periapsis

Instances

Eq a => Eq (Orbit a) 
Show a => Show (Orbit a)

An orbit is only showable if the type of the centerBody is also showable. As a should normaly be a Body that should be not a problem.

mkOrbit :: a -> Height -> Height -> Orbit a Source

mkOrbit takes a body as well as apoapsis and periapsis and of that creates an orbit.

mkCircOrbit :: a -> Height -> Orbit a Source

mkCircOrbit is similar to mkOrbit with the difference that it creates a circular orbit.

type Height = Double Source

The Height is the height above ground level.

data System b a Source

The System module contains the type definition of a System.

Constructors

Empty 
System [(Orbit b, a)] 

Instances

Functor (System b)

Making 'System b' a member of class functor. With this instance, one could use map over 'System b'.

(Eq b, Eq a) => Eq (System b a) 
(Show a, Show b) => Show (System b a)

A System could be shown, if both type parameters are also filled with types, that are showable.

type GravConst = Double Source

GravConst is the type of the gravitation constant, which is obious a double.

type KSystem = System Body Source

KSystem creates a data constructor, that binds the System to a System of Orbits around Bodys.