![]() |
TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Ground to ground projectile motion equation implementations. More...
#include <cassert>
#include <cmath>
#include <iostream>
Go to the source code of this file.
Namespaces | |
namespace | physics |
for IO operations | |
namespace | ground_to_ground_projectile_motion |
Functions for the Ground to ground projectile motion equation. |
Macros | |
#define | _USE_MATH_DEFINES |
for assert() |
Functions | |
double | physics::ground_to_ground_projectile_motion::degrees_to_radians (double degrees) |
Convert radians to degrees. | |
template<typename T> | |
T | physics::ground_to_ground_projectile_motion::time_of_flight (T initial_velocity, T angle, double gravity=GRAVITY) |
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=GRAVITY) |
Calculate the max height of the projectile. | |
static void | test () |
Self-test implementations. | |
int | main () |
Main function. |
Variables | |
constexpr double | GRAVITY = 9.80665 |
Standard gravity (m/s^2) |
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.
Definition in file ground_to_ground_projectile_motion.cpp.
#define _USE_MATH_DEFINES |
for assert()
Definition at line 13 of file ground_to_ground_projectile_motion.cpp.
double physics::ground_to_ground_projectile_motion::degrees_to_radians | ( | double | degrees | ) |
Convert radians to degrees.
radian | Angle in radians |
Definition at line 39 of file ground_to_ground_projectile_motion.cpp.
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 |
Definition at line 64 of file ground_to_ground_projectile_motion.cpp.
int main | ( | void | ) |
Main function.
Definition at line 143 of file ground_to_ground_projectile_motion.cpp.
T physics::ground_to_ground_projectile_motion::max_height | ( | T | initial_velocity, |
T | angle, | ||
double | gravity = GRAVITY ) |
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 |
Definition at line 77 of file ground_to_ground_projectile_motion.cpp.
|
static |
Self-test implementations.
Definition at line 88 of file ground_to_ground_projectile_motion.cpp.
T physics::ground_to_ground_projectile_motion::time_of_flight | ( | T | initial_velocity, |
T | angle, | ||
double | gravity = GRAVITY ) |
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 |
Definition at line 52 of file ground_to_ground_projectile_motion.cpp.
|
constexpr |
Standard gravity (m/s^2)
Definition at line 23 of file ground_to_ground_projectile_motion.cpp.