11# distlink-python
22
3- A source-level Python port of the ` distlink-cpp ` implementation of the
4- two-orbit minimum orbit intersection distance (MOID) and linking coefficients.
3+ An unofficial, source-level Python port of the DISTLINK C++ library for
4+ computing the minimum orbit intersection distance (MOID) and orbital linking
5+ coefficients. The public API retains the C++ names to make examples and
6+ results straightforward to compare.
57
6- The public API intentionally retains the C++ names so existing examples are
7- easy to translate:
8+ This port is maintained independently and is not represented as an official
9+ release by the original DISTLINK authors.
10+
11+ ## Installation
12+
13+ After the first PyPI release:
14+
15+ ``` text
16+ python -m pip install distlink-python
17+ ```
18+
19+ The distribution is named ` distlink-python ` ; the import name is ` distlink ` .
20+ To install the current development version directly from GitHub:
21+
22+ ``` text
23+ python -m pip install git+https://github.com/troyrock/distlink-python.git
24+ ```
25+
26+ The implementation uses only the Python standard library and supports Python
27+ 3.10 and later.
28+
29+ ## Quick start
830
931``` python
1032from distlink import COrbitData, MOID_fast , detect_suitable_options
@@ -16,30 +38,60 @@ result = MOID_fast(earth, asteroid, max_root_error, min_root_error)
1638print (result.distance, result.good)
1739```
1840
19- Angles are in radians. Distance results use the same unit as the supplied
20- semimajor axes. The implementation uses only the Python standard library.
21-
22- Run the standard-library test suite from this directory with:
41+ Angles are in radians. Distance results use the same unit as the supplied
42+ semimajor axes. Python ` float ` corresponds to the C++ ` double `
43+ instantiation.
2344
24- ``` text
25- python -m unittest discover -s tests -v
26- ```
45+ ## Input and numerical behavior
2746
28- ` tests/oracle.cpp ` is a small command-line adapter around the unmodified C++
29- library. The parity tests compile it as C++20 with GNU C++ and compare Python
30- results against fresh C++ results.
31-
32- Orbital elements and numerical options must be finite. Eccentricity must be
33- nonnegative and exactly parabolic orbits (` e == 1 ` ) are rejected. A nonzero
47+ Orbital elements and numerical options must be finite. Eccentricity must be
48+ nonnegative, and exactly parabolic orbits (` e == 1 ` ) are rejected. A nonzero
3449semimajor axis is canonicalized to positive for an ellipse and negative for a
35- hyperbola. Invalid inputs raise ` ValueError ` .
50+ hyperbola. Invalid inputs raise ` ValueError ` .
3651
37- ` MOID_fast ` is deterministic and supports circular first orbits directly: it
52+ ` MOID_fast ` is deterministic and supports circular first orbits directly. It
3853automatically exchanges the pair when only the first orbit is circular and
39- uses the exact two-circle solution when both are circular. For other results
54+ uses the exact two-circle solution when both are circular. For other results
4055marked unreliable, retrying in the opposite order remains reasonable before
4156using ` MOID_direct_search ` as the fallback.
4257
43- The direct scanner uses a full anomaly range for coplanar elliptic orbits. It
58+ The direct scanner uses a full anomaly range for coplanar elliptic orbits. It
4459rejects a coplanar hyperbolic pair because no finite scan interval can in
4560general bound both unbounded branches; use ` MOID_fast ` for that case.
61+
62+ ## Verification against C++
63+
64+ The standard-library test suite compiles a fresh C++20 command-line oracle and
65+ compares Python results with it:
66+
67+ ``` text
68+ python -m unittest discover -s tests -v
69+ ```
70+
71+ The release CI pins the oracle to
72+ [ ` troyrock/distlink-cpp@58c1c29 ` ] ( https://github.com/troyrock/distlink-cpp/commit/58c1c29ad1555920e004ff6fc8b932e954751147 ) .
73+ For a local checkout, place ` distlink-python ` and ` distlink-cpp ` beside one
74+ another, as they are in the development workspace.
75+
76+ ## Provenance and references
77+
78+ This code is a direct Python translation of DISTLINK by Roman V. Baluev and
79+ Denis V. Mikryukov. The original project is distributed at
80+ [ SourceForge] ( https://sourceforge.net/projects/distlink/ ) ; the maintained
81+ C++20 oracle used for this port is available at
82+ [ ` troyrock/distlink-cpp ` ] ( https://github.com/troyrock/distlink-cpp ) .
83+
84+ The underlying algorithms are described in:
85+
86+ - R. V. Baluev and D. V. Mikryukov, “Fast error-controlling MOID computation
87+ for confocal elliptic orbits,” * Astronomy and Computing* 27 (2019), 11–22,
88+ [ doi:10.1016/j.ascom.2019.02.005] ( https://doi.org/10.1016/j.ascom.2019.02.005 ) .
89+ - R. V. Baluev, “Fast error-safe MOID computation involving hyperbolic
90+ orbits,” * Astronomy and Computing* 34 (2021), 100440,
91+ [ doi:10.1016/j.ascom.2020.100440] ( https://doi.org/10.1016/j.ascom.2020.100440 ) .
92+
93+ ## License
94+
95+ The original C++ work and this Python translation are distributed under the
96+ MIT License. The original authors' copyright and permission notice are
97+ preserved in [ ` LICENSE ` ] ( LICENSE ) and in the translated source.
0 commit comments