Zephyr Scientific Library (zscilib)
|
Projectile functions. More...
Files | |
file | projectiles.h |
API header file for projectiles in zscilib. | |
Functions | |
int | zsl_phy_proj_init_vel (zsl_real_t vi, zsl_real_t theta, zsl_real_t *vih, zsl_real_t *viv) |
Decomposes the initial velocity of an object under projectile motion into its horizontal and vertical components based on the angle (theta) it is launched at. More... | |
int | zsl_phy_proj_time (zsl_real_t viv, zsl_real_t yi, zsl_real_t yf, zsl_real_t *t) |
Calculates the total time of travel in seconds of an object under projectile motion from an initial height (yi) and a final height (yf) given the vertical velocity at the starting point. Measurements are based on reaching yf on descent. More... | |
int | zsl_phy_proj_time_first (zsl_real_t viv, zsl_real_t yi, zsl_real_t yf, zsl_real_t *t) |
Calculates the total time of travel in seconds of an object under projectile motion from an initial height (yi) and a final height (yf) given the vertical velocity at the starting point. Measurements are based on the first instance that yf is reached, which can occur during the ascent or descent stages depending on values provided. More... | |
int | zsl_phy_proj_time2 (zsl_real_t viv, zsl_real_t vfv, zsl_real_t *t) |
Calculates the total time of travel in seconds of an object under projectile motion based on the vertical velocity at the starting and ending points. More... | |
int | zsl_phy_proj_ver_motion (zsl_real_t viv, zsl_real_t t, zsl_real_t yi, zsl_real_t *yf) |
Calculates the height in meters of an object under projectile motion based on the initial vertical velocity (viv), the initial height (yi) and the time (t). More... | |
int | zsl_phy_proj_ver_vel (zsl_real_t viv, zsl_real_t t, zsl_real_t *vfv) |
Calculates the vertical velocity in meters per second of an object under projectile motion based on the initial vertical velocity (viv), and the time (t). More... | |
int | zsl_phy_proj_hor_motion (zsl_real_t vih, zsl_real_t t, zsl_real_t xi, zsl_real_t *xf) |
Calculates the horizontal position in meters of an object under projectile motion based on the horizontal velocity (vih), the time (t) and the initial horizontal position (xi). More... | |
int | zsl_phy_proj_trajectory (zsl_real_t vih, zsl_real_t viv, zsl_real_t xi, zsl_real_t yi, zsl_real_t xf, zsl_real_t *yf) |
Calculates the vertical position in meters of an object under projectile motion at any given horizontal position, knowing the initial vertical velocity (viv), the horizontal velocity (vih) and the coordinates of the launching point (xi, yi). More... | |
int | zsl_phy_proj_vel (zsl_real_t vfh, zsl_real_t vfv, zsl_real_t *vf) |
Calculates the module of the total velocity in meters per second of an object under projectile motion at any point, given the vertical (vfv) and horizontal (vfh) velocities at that point. More... | |
int | zsl_phy_proj_angle (zsl_real_t vfh, zsl_real_t vfv, zsl_real_t *theta) |
Calculates the angle in radians between the floor and the total velocity of an object under projectile motion based on the vertical (vfv) and horizontal (vfh) velocities. More... | |
int | zsl_phy_proj_range (zsl_real_t vih, zsl_real_t viv, zsl_real_t xi, zsl_real_t yi, zsl_real_t *dist) |
Calculates the horizontal distance in meters between the launching point of an object and the point where it reaches the ground based on the initial vertical velocity (viv), the horizontal velocity (vih) and the coordinates of the launching point (xi, yi). More... | |
Projectile functions.
int zsl_phy_proj_angle | ( | zsl_real_t | vfh, |
zsl_real_t | vfv, | ||
zsl_real_t * | theta | ||
) |
Calculates the angle in radians between the floor and the total velocity of an object under projectile motion based on the vertical (vfv) and horizontal (vfh) velocities.
vfh | Horizontal velocity of the object in meters per second. |
vfv | Vertical velocity of the object in meters per second. |
theta | Pointer to the output angle in radians. |
int zsl_phy_proj_hor_motion | ( | zsl_real_t | vih, |
zsl_real_t | t, | ||
zsl_real_t | xi, | ||
zsl_real_t * | xf | ||
) |
Calculates the horizontal position in meters of an object under projectile motion based on the horizontal velocity (vih), the time (t) and the initial horizontal position (xi).
vih | Horizontal velocity of the object in meters per second. |
t | Time that has transcurred from the moment the object was launched, in seconds. |
xi | Horizontal initial position of the object in meters. |
xf | Pointer to the output horizontal position in meters. If the time is negative, it will be set to NAN. |
int zsl_phy_proj_init_vel | ( | zsl_real_t | vi, |
zsl_real_t | theta, | ||
zsl_real_t * | vih, | ||
zsl_real_t * | viv | ||
) |
Decomposes the initial velocity of an object under projectile motion into its horizontal and vertical components based on the angle (theta) it is launched at.
vi | Initial velocity of the object in meters per second. |
theta | Angle between the floor and the initial velocity in radians. |
vih | Pointer to the output horizontal component of the initial velocity in meters per second. |
viv | Pointer to the output vertical component of the initial velocity in meters per second. |
int zsl_phy_proj_range | ( | zsl_real_t | vih, |
zsl_real_t | viv, | ||
zsl_real_t | xi, | ||
zsl_real_t | yi, | ||
zsl_real_t * | dist | ||
) |
Calculates the horizontal distance in meters between the launching point of an object and the point where it reaches the ground based on the initial vertical velocity (viv), the horizontal velocity (vih) and the coordinates of the launching point (xi, yi).
vih | Horizontal velocity of the object in meters per second. |
viv | Initial vertical velocity of the object in meters per second. |
xi | Horizontal initial position of the object in meters. |
yi | Vertical initial position of the object in meters. |
dist | Pointer to the output distance in meters. |
int zsl_phy_proj_time | ( | zsl_real_t | viv, |
zsl_real_t | yi, | ||
zsl_real_t | yf, | ||
zsl_real_t * | t | ||
) |
Calculates the total time of travel in seconds of an object under projectile motion from an initial height (yi) and a final height (yf) given the vertical velocity at the starting point. Measurements are based on reaching yf on descent.
viv | Initial vertical velocity of the object at the starting point in meters per second. |
yi | Initial height in meters. |
yf | Final height in meters. |
t | Pointer to the output total time of flight of the object in seconds. Will be set to NAN if the object never reaches the final height. |
int zsl_phy_proj_time2 | ( | zsl_real_t | viv, |
zsl_real_t | vfv, | ||
zsl_real_t * | t | ||
) |
Calculates the total time of travel in seconds of an object under projectile motion based on the vertical velocity at the starting and ending points.
viv | Initial vertical velocity of the object at the starting point in meters per second. |
vfv | Final vertical velocity of the object at the ending point in meters per second. |
t | Pointer to the output total time of flight of the object in seconds. If t is a negative value, it will be set to NAN. |
int zsl_phy_proj_time_first | ( | zsl_real_t | viv, |
zsl_real_t | yi, | ||
zsl_real_t | yf, | ||
zsl_real_t * | t | ||
) |
Calculates the total time of travel in seconds of an object under projectile motion from an initial height (yi) and a final height (yf) given the vertical velocity at the starting point. Measurements are based on the first instance that yf is reached, which can occur during the ascent or descent stages depending on values provided.
viv | Initial vertical velocity of the object at the starting point in meters per second. |
yi | Initial height in meters. |
yf | Final height in meters. |
t | Pointer to the output total time of flight of the object in seconds. If t is a negative value of if the projectile doesn't reach y2, it will be set to NAN. |
int zsl_phy_proj_trajectory | ( | zsl_real_t | vih, |
zsl_real_t | viv, | ||
zsl_real_t | xi, | ||
zsl_real_t | yi, | ||
zsl_real_t | xf, | ||
zsl_real_t * | yf | ||
) |
Calculates the vertical position in meters of an object under projectile motion at any given horizontal position, knowing the initial vertical velocity (viv), the horizontal velocity (vih) and the coordinates of the launching point (xi, yi).
vih | Horizontal velocity of the object in meters per second. |
viv | Initial vertical velocity of the object in meters per second. |
xi | Horizontal initial position of the object in meters. |
yi | Vertical initial position of the object in meters. |
xf | Horizontal final position of the object in meters. |
yf | Pointer to the output height in meters. If the horizontal velocity is zero it will be set to NAN. |
int zsl_phy_proj_vel | ( | zsl_real_t | vfh, |
zsl_real_t | vfv, | ||
zsl_real_t * | vf | ||
) |
Calculates the module of the total velocity in meters per second of an object under projectile motion at any point, given the vertical (vfv) and horizontal (vfh) velocities at that point.
vfh | Horizontal velocity of the object in meters per second. |
vfv | Vertical velocity of the object in meters per second. |
vf | Pointer to the output total velocity in meters per second. |
int zsl_phy_proj_ver_motion | ( | zsl_real_t | viv, |
zsl_real_t | t, | ||
zsl_real_t | yi, | ||
zsl_real_t * | yf | ||
) |
Calculates the height in meters of an object under projectile motion based on the initial vertical velocity (viv), the initial height (yi) and the time (t).
viv | Initial vertical velocity of the object when launched in meters per second. |
t | Time that has transcurred from the moment the object was launched, in seconds. |
yi | Initial height of the object in meters. |
yf | Pointer to the output height of the object in meters. If the time is negative, it will be set to NAN. |
int zsl_phy_proj_ver_vel | ( | zsl_real_t | viv, |
zsl_real_t | t, | ||
zsl_real_t * | vfv | ||
) |
Calculates the vertical velocity in meters per second of an object under projectile motion based on the initial vertical velocity (viv), and the time (t).
viv | Initial vertical velocity of the object when launched in meters per second. |
t | Time that has transcurred from the moment the object was launched, in seconds. |
vfv | Pointer to the output vertical velocity in meters per second. If the time is negative, it will be set to NAN. |