Two-body Keplerian orbit propagation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add ocaml-vec3: shared 3D vector type

+39 -1
+3
lib/analytic.ml
··· 177 177 178 178 let period el = if el.a <= 0. then infinity (* hyperbolic *) else twopi /. el.n 179 179 let eccentricity el = el.e 180 + let semi_major_axis el = el.a 181 + let inclination el = el.i 182 + let pp ppf el = Fmt.pf ppf "a=%.3f km e=%.6f i=%.4f rad" el.a el.e el.i 180 183 181 184 (** {1 Public API} *) 182 185
+9
lib/analytic.mli
··· 22 22 val eccentricity : elements -> float 23 23 (** [eccentricity el] is the orbital eccentricity. *) 24 24 25 + val semi_major_axis : elements -> float 26 + (** [semi_major_axis el] is the semi-major axis in km. *) 27 + 28 + val inclination : elements -> float 29 + (** [inclination el] is the orbital inclination in radians. *) 30 + 31 + val pp : elements Fmt.t 32 + (** Pretty-print orbital elements. *) 33 + 25 34 (** {1 Propagation} *) 26 35 27 36 val at : pos:Vec3.t -> vel:Vec3.t -> dt:float -> Vec3.t
+12
lib/vec3.ml
··· 22 22 } 23 23 24 24 let length v = sqrt ((v.x *. v.x) +. (v.y *. v.y) +. (v.z *. v.z)) 25 + 26 + let normalize v = 27 + let n = length v in 28 + if n < 1e-15 then v else scale (1.0 /. n) v 29 + 30 + let negate v = { x = -.v.x; y = -.v.y; z = -.v.z } 31 + 32 + let equal ?(eps = 1e-12) a b = 33 + Float.abs (a.x -. b.x) <= eps 34 + && Float.abs (a.y -. b.y) <= eps 35 + && Float.abs (a.z -. b.z) <= eps 36 + 25 37 let pp ppf v = Fmt.pf ppf "(%g, %g, %g)" v.x v.y v.z
+15 -1
lib/vec3.mli
··· 1 - (** 3D vector operations. *) 1 + (** 3D vector operations. 2 + 3 + Provides basic arithmetic, products, and comparison for three-component 4 + floating-point vectors used throughout the orbital mechanics libraries. *) 2 5 3 6 type t = { x : float; y : float; z : float } 4 7 ··· 25 28 26 29 val length : t -> float 27 30 (** [length v] is the Euclidean length. *) 31 + 32 + val normalize : t -> t 33 + (** [normalize v] returns the unit vector in the direction of [v]. Returns [v] 34 + unchanged if its length is near zero. *) 35 + 36 + val negate : t -> t 37 + (** [negate v] is the component-wise negation of [v]. *) 38 + 39 + val equal : ?eps:float -> t -> t -> bool 40 + (** [equal ?eps a b] is [true] when each component differs by at most [eps] 41 + (default [1e-12]). *) 28 42 29 43 val pp : t Fmt.t 30 44 (** [pp] pretty-prints a vector. *)