Two-body Keplerian orbit propagation
0
fork

Configure Feed

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

chore: stage linter changes across packages

+1 -82
+1 -1
lib/dune
··· 1 1 (library 2 2 (name kepler) 3 3 (public_name kepler) 4 - (libraries fmt)) 4 + (libraries vec3 fmt))
-37
lib/vec3.ml
··· 1 - (*--------------------------------------------------------------------------- 2 - Copyright (c) 2025 Thomas Gazagnaire. All rights reserved. 3 - SPDX-License-Identifier: ISC 4 - ---------------------------------------------------------------------------*) 5 - 6 - (** 3D vector operations. *) 7 - 8 - type t = { x : float; y : float; z : float } 9 - 10 - let v x y z = { x; y; z } 11 - let zero = { x = 0.; y = 0.; z = 0. } 12 - let add a b = { x = a.x +. b.x; y = a.y +. b.y; z = a.z +. b.z } 13 - let scale s v = { x = s *. v.x; y = s *. v.y; z = s *. v.z } 14 - let sub a b = { x = a.x -. b.x; y = a.y -. b.y; z = a.z -. b.z } 15 - let dot a b = (a.x *. b.x) +. (a.y *. b.y) +. (a.z *. b.z) 16 - 17 - let cross a b = 18 - { 19 - x = (a.y *. b.z) -. (a.z *. b.y); 20 - y = (a.z *. b.x) -. (a.x *. b.z); 21 - z = (a.x *. b.y) -. (a.y *. b.x); 22 - } 23 - 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 - 37 - let pp ppf v = Fmt.pf ppf "(%g, %g, %g)" v.x v.y v.z
-44
lib/vec3.mli
··· 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. *) 5 - 6 - type t = { x : float; y : float; z : float } 7 - 8 - val v : float -> float -> float -> t 9 - (** [v x y z] is the vector [(x, y, z)]. *) 10 - 11 - val zero : t 12 - (** [zero] is the origin. *) 13 - 14 - val add : t -> t -> t 15 - (** [add a b] is the component-wise sum. *) 16 - 17 - val scale : float -> t -> t 18 - (** [scale s v] multiplies each component by [s]. *) 19 - 20 - val sub : t -> t -> t 21 - (** [sub a b] is the component-wise difference. *) 22 - 23 - val dot : t -> t -> float 24 - (** [dot a b] is the dot product. *) 25 - 26 - val cross : t -> t -> t 27 - (** [cross a b] is the cross product. *) 28 - 29 - val length : t -> float 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]). *) 42 - 43 - val pp : t Fmt.t 44 - (** [pp] pretty-prints a vector. *)