3D vectors for astrodynamics and rendering
0
fork

Configure Feed

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

OCaml 78.9%
Dune 6.0%
Other 15.2%
14 1 0

Clone this repository

https://tangled.org/gazagnaire.org/ocaml-vec3 https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-vec3
git@git.recoil.org:gazagnaire.org/ocaml-vec3 git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-vec3

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

vec3 -- 3D vectors for astrodynamics and rendering#

Minimal 3D vector library providing a shared type for astrodynamics, coordinate transforms, and rendering. Used as the common vector type across kepler, sgp4, globe, and coordinate packages.

Installation#

Install with opam:

$ opam install vec3

If opam cannot find the package, it may not yet be released in the public opam-repository. Add the overlay repository, then install it:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install vec3

Usage#

open Vec3
let a = v 1.0 2.0 3.0
let b = v 4.0 5.0 6.0
let c = add a b
let d = cross a b
let len = length c
let unit = normalize c
let () = Fmt.pr "%a cross %a (length: %f)@." pp unit pp d len

API#

  • v x y z -- create a vector
  • zero -- the zero vector
  • add, sub, scale, negate -- arithmetic
  • dot, cross -- products
  • length, distance -- metrics
  • normalize -- unit vector (returns zero if near-zero input)
  • equal ?eps -- approximate equality (default epsilon: 1e-12)
  • pp -- pretty-printer

License#

ISC