No project description provided
Project description
ballistic-solver is a native C/C++ numerical solver that computes launch angles to intercept moving targets under gravity and quadratic air drag. Unlike vacuum / closed-form approaches, this solver simulates the projectile and solves the intercept numerically, targeting robustness for real-time simulations even when trajectories are strongly curved.
Quick start
Python (wheel)
pip install ballistic-solver
Requires Python >= 3.10.
import ballistic_solver as bs
result = bs.solve(
relPos0=(120, 30, 5),
relVel=(2, -1, 0),
v0=90,
kDrag=0.002,
)
print(result["theta"], result["phi"], result["miss"])
print(result["success"], result["status"], result["message"])
Signature (actual binding)
solve(relPos0, relVel, v0, kDrag, arcMode=0, params=None) -> dict
arcModeaccepts0/1or"low"/"high"(case-insensitive).- Important: the
arcModeargument overridesparams.arcModeeven ifparamsis provided.
Returned dict keys include:
success,theta,phi,miss,tStar,relMissAtStarstatus,messageiterations,acceptedSteps,lastLambda,lastAlpha
C ABI (stable interface)
void ballistic_inputs_init(BallisticInputs* in);
int32_t ballistic_solve(const BallisticInputs* in, BallisticOutputs* out);
See ballistic_solver_c_api.h for BallisticInputs/Outputs definitions and defaults.
Demo (Unity)
Highly curved trajectories under strong air drag, still converging to a hit against moving targets.
https://github.com/user-attachments/assets/dcaf7479-cb94-477a-b71e-470a5b4c6004
Key properties
- Moving targets supported
- Strong air resistance (quadratic drag) supported
- Robust in strongly nonlinear regimes (no analytic assumptions)
- Best-effort result returned even without perfect convergence
- Explicit success / failure reporting (+ diagnostic message)
- Stable C ABI for multi-language use
- Header-only C++ core
- Low / High arc selection (since v0.2.0)
Arc mode (since v0.2.0)
C ABI convention:
arcMode = 0→ LowarcMode = 1→ High
High arc example:
https://github.com/user-attachments/assets/4334ed87-597e-4ad4-b21e-c1a1a17e8cd8
How it works (high level)
- Simulate projectile motion using RK4 integration with drag (+ wind in core/C ABI)
- Track the closest approach between projectile and target
- Express the miss at closest approach as an angular residual
- Solve the nonlinear system using damped least squares (Levenberg–Marquardt)
- Accelerate Jacobian updates with Broyden-style refinement
- Return the best solution found
Failure cases are explicitly detected and reported.
Advanced parameters (C ABI)
BallisticInputs exposes additional controls (all have defaults via ballistic_inputs_init):
g(gravity)wind[3](wind vector)dt(RK4 step)tMax(max sim time)tolMiss(hit tolerance)maxIter(LM iterations)
Note: The current Python binding exposes many tuning parameters via BallisticParams,
but does not expose wind as a Python field.
Status codes (SolveStatus)
BallisticOutputs.status / Python result["status"] corresponds to the core enum:
0= Ok1= InvalidInput2= InitialResidualFailed3= JacobianFailed4= LMStepSingular5= ResidualFailedDuringSearch6= LineSearchRejected7= LambdaTriesExhausted8= MaxIterReached
message contains a short diagnostic string.
Using prebuilt binaries
Download the archive for your platform from Releases.
Each release contains:
-
Shared library
- Windows:
ballistic_solver.dll - Linux:
libballistic_solver.so - macOS:
libballistic_solver.dylib
- Windows:
-
C ABI header:
ballistic_solver_c_api.h
C# / Unity usage
A C# P/Invoke example is available in:
examples/dotnet/
On Windows, place ballistic_solver.dll next to the executable
(or ensure it is discoverable via PATH),
then call ballistic_solve via DllImport.
Build from source
cmake -S . -B build
cmake --build build -j
ctest --test-dir build
The shared library target is ballistic_solver.
ABI notes
- Plain C layout across the ABI boundary
- Fixed-size arrays only
- No dynamic allocation across the boundary
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ballistic_solver-0.3.2.tar.gz.
File metadata
- Download URL: ballistic_solver-0.3.2.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6cda56c493d8b9ea96bf40477a1a9171cdc49ff10901b8da4220df9e9794d7c
|
|
| MD5 |
8dbb49007b93bc886aed18fd7b2f4be3
|
|
| BLAKE2b-256 |
94c7f16ade8f6cc3dbeae802dfe3d51bedf271ae83e7350f2dc0a48cc0efd4d3
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2.tar.gz:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2.tar.gz -
Subject digest:
e6cda56c493d8b9ea96bf40477a1a9171cdc49ff10901b8da4220df9e9794d7c - Sigstore transparency entry: 820950220
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file ballistic_solver-0.3.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: ballistic_solver-0.3.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 104.4 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a64ab9b75344069118a893c89b13d7300b4ca5f4a60aceccd8ee7ea50f854a4
|
|
| MD5 |
be0ee27ec33768c646dc6a4f9b3687a0
|
|
| BLAKE2b-256 |
385f14ba0d65ca3045f1af649fa850bff7efa976fd0ba4fdf3bfea89b907e59a
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2-cp312-cp312-win_amd64.whl:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2-cp312-cp312-win_amd64.whl -
Subject digest:
4a64ab9b75344069118a893c89b13d7300b4ca5f4a60aceccd8ee7ea50f854a4 - Sigstore transparency entry: 820950283
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file ballistic_solver-0.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ballistic_solver-0.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 119.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c08434c0d5bacf4a98eba975f6d9aa4238039bf86dbea74aa94055f736c0e278
|
|
| MD5 |
89180044d81837def809beee658e0ab6
|
|
| BLAKE2b-256 |
24b0269fa1617d734cc2cf23903a04c917f1e79ca3f5d81d4db5f17d529315d3
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
c08434c0d5bacf4a98eba975f6d9aa4238039bf86dbea74aa94055f736c0e278 - Sigstore transparency entry: 820950269
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file ballistic_solver-0.3.2-cp312-cp312-macosx_10_13_universal2.whl.
File metadata
- Download URL: ballistic_solver-0.3.2-cp312-cp312-macosx_10_13_universal2.whl
- Upload date:
- Size: 192.2 kB
- Tags: CPython 3.12, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1658d8c19437cf82cac347dbbd366b73b44308e2be8288499ab04e6fca2a5c47
|
|
| MD5 |
8ee858c2bb0c3c6a47722552783dff55
|
|
| BLAKE2b-256 |
4611c5fcdabba21473cd734cbeaf437033d48026bbc9d36f23c2a34680f768fe
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2-cp312-cp312-macosx_10_13_universal2.whl:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2-cp312-cp312-macosx_10_13_universal2.whl -
Subject digest:
1658d8c19437cf82cac347dbbd366b73b44308e2be8288499ab04e6fca2a5c47 - Sigstore transparency entry: 820950227
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file ballistic_solver-0.3.2-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: ballistic_solver-0.3.2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 103.3 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c55925e073faa78e02ffca38addd93b579f577c66c4a2c1d82a198c5d8514ccf
|
|
| MD5 |
686b261f22dec467b5ca69498d22dc87
|
|
| BLAKE2b-256 |
4f8b94c9910966b5fcc3df6b42dd23f5e6b92de1ae37ca598ad21506856b6c11
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2-cp311-cp311-win_amd64.whl:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2-cp311-cp311-win_amd64.whl -
Subject digest:
c55925e073faa78e02ffca38addd93b579f577c66c4a2c1d82a198c5d8514ccf - Sigstore transparency entry: 820950245
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file ballistic_solver-0.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ballistic_solver-0.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 116.3 kB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
917e9bce05e70508bfd84539a853be8ea7902b898569f4be7e16e8b8436c2685
|
|
| MD5 |
abd3ba06862129ccd6b3ae10302f0c06
|
|
| BLAKE2b-256 |
e469416e537c2b328df480108ea2f9f1da99904525e0c41692189512a796fd89
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
917e9bce05e70508bfd84539a853be8ea7902b898569f4be7e16e8b8436c2685 - Sigstore transparency entry: 820950256
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file ballistic_solver-0.3.2-cp311-cp311-macosx_10_9_universal2.whl.
File metadata
- Download URL: ballistic_solver-0.3.2-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 190.8 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dec99fbece6da748e506cbda295a8293770fedfcce6ffea777ef379e2fbd32dd
|
|
| MD5 |
43089d667213da9300d5517f2714716b
|
|
| BLAKE2b-256 |
ce0ff8e82cf70cd1b251a24237696915977a8b7e055d1f569c4e3c2aedce8d67
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2-cp311-cp311-macosx_10_9_universal2.whl:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2-cp311-cp311-macosx_10_9_universal2.whl -
Subject digest:
dec99fbece6da748e506cbda295a8293770fedfcce6ffea777ef379e2fbd32dd - Sigstore transparency entry: 820950293
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file ballistic_solver-0.3.2-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: ballistic_solver-0.3.2-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 102.6 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25ea858c7af9181eea31f0d80fa5be45667636672e041a3a5238e4ee3757f805
|
|
| MD5 |
69445c6a43d0cd312e32a7018a1df30c
|
|
| BLAKE2b-256 |
9c8c74df5ee600232ee28753addba69f10fa63ce28b3c1a2cdc9c734cbc42deb
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2-cp310-cp310-win_amd64.whl:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2-cp310-cp310-win_amd64.whl -
Subject digest:
25ea858c7af9181eea31f0d80fa5be45667636672e041a3a5238e4ee3757f805 - Sigstore transparency entry: 820950235
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file ballistic_solver-0.3.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ballistic_solver-0.3.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 115.7 kB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
541b569d22beb772309b8661ee2545f8418d4c0487530ecdd83d74e4c94f883c
|
|
| MD5 |
d724a82ca3a1dc775742b99dacc80fcf
|
|
| BLAKE2b-256 |
99028dec6d1a96437e731e6c52f73f8a2bc844a0c639d52c6f842fd45b6a995c
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
541b569d22beb772309b8661ee2545f8418d4c0487530ecdd83d74e4c94f883c - Sigstore transparency entry: 820950261
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file ballistic_solver-0.3.2-cp310-cp310-macosx_10_9_universal2.whl.
File metadata
- Download URL: ballistic_solver-0.3.2-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 188.1 kB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20220efb22c83faec97d4c789163d274895ff07257a596057a4ffd2d96b5dbed
|
|
| MD5 |
147d5793b11ca76c7f71fbcb1a5839fa
|
|
| BLAKE2b-256 |
4bbb149b8035ba22556130485117e47252c4d61c70b9a8dffa69d4ac6e3010a4
|
Provenance
The following attestation bundles were made for ballistic_solver-0.3.2-cp310-cp310-macosx_10_9_universal2.whl:
Publisher:
release.yml on ujinf74/ballistic-solver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ballistic_solver-0.3.2-cp310-cp310-macosx_10_9_universal2.whl -
Subject digest:
20220efb22c83faec97d4c789163d274895ff07257a596057a4ffd2d96b5dbed - Sigstore transparency entry: 820950231
- Sigstore integration time:
-
Permalink:
ujinf74/ballistic-solver@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ujinf74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ac5afbbe6e69c3004ec1a0440102346d9e979ca -
Trigger Event:
push
-
Statement type: