Skip to content

Instantly share code, notes, and snippets.

View h3r's full-sized avatar
🐦

Hermann Plass h3r

🐦
  • UPF-GTI
  • BCN
View GitHub Profile
@h3r
h3r / ballistic.h
Created May 23, 2020 12:08
Solving Ballistic Trajectories
/*
C/C++ reimplementation of the code.
Read: https://www.forrestthewoods.com/blog/solving_ballistic_trajectories/
Source: https://github.com/forrestthewoods/lib_fts/blob/master/code/fts_ballistic_trajectory.cs
Dependencies: https://github.com/Microsoft/DirectXTK/wiki/SimpleMath
HPlass (hermann.plass@gmail.com) - 2020
*/
bool solve_ballistic_arc_lateral(const VEC3 proj_pos, const float lateral_speed, const VEC3 target_pos, const float max_height, VEC3& fire_velocity, float& gravity)
{