Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Ground to ground projectile motion equation implementations. More...
#include <cassert>
#include <cmath>
#include <iostream>
Namespaces | |
namespace | physics |
for IO operations | |
namespace | ground_to_ground_projectile_motion |
Functions for the Ground to ground projectile motion equation. | |
Functions | |
double | physics::ground_to_ground_projectile_motion::degrees_to_radians (double radian, double PI=3.14) |
Convert radians to degrees. | |
template<typename T > | |
T | physics::ground_to_ground_projectile_motion::time_of_flight (T initial_velocity, T angle, double gravity=9.81) |
Calculate the time of flight. | |
template<typename T > | |
T | physics::ground_to_ground_projectile_motion::horizontal_range (T initial_velocity, T angle, T time) |
Calculate the horizontal distance that the projectile travels. | |
template<typename T > | |
T | physics::ground_to_ground_projectile_motion::max_height (T initial_velocity, T angle, double gravity=9.81) |
Calculate the max height of the projectile. | |
static void | test () |
Self-test implementations. | |
int | main () |
Main function. | |
Ground to ground projectile motion equation implementations.
Ground to ground projectile motion is when a projectile's trajectory starts at the ground, reaches the apex, then falls back on the ground.
double physics::ground_to_ground_projectile_motion::degrees_to_radians | ( | double | radian, |
double | PI = 3.14 ) |
Convert radians to degrees.
radian | Angle in radians |
PI | The definition of the constant PI |
T physics::ground_to_ground_projectile_motion::horizontal_range | ( | T | initial_velocity, |
T | angle, | ||
T | time ) |
Calculate the horizontal distance that the projectile travels.
initial_velocity | The starting velocity of the projectile |
time | The time that the projectile is in the air |
int main | ( | void | ) |
T physics::ground_to_ground_projectile_motion::max_height | ( | T | initial_velocity, |
T | angle, | ||
double | gravity = 9.81 ) |
Calculate the max height of the projectile.
initial_velocity | The starting velocity of the projectile |
angle | The angle that the projectile is launched at in degrees |
gravity | The value used for the gravity constant |
|
static |
Self-test implementations.
T physics::ground_to_ground_projectile_motion::time_of_flight | ( | T | initial_velocity, |
T | angle, | ||
double | gravity = 9.81 ) |
Calculate the time of flight.
initial_velocity | The starting velocity of the projectile |
angle | The angle that the projectile is launched at in degrees |
gravity | The value used for the gravity constant |