Zephyr Scientific Library (zscilib)
Files | Functions
Kinematics

Kinematics functions. More...

Files

file  kinematics.h
 API header file for kinematics in zscilib.
 

Functions

int zsl_phy_kin_dist (zsl_real_t vi, zsl_real_t time, zsl_real_t accel, zsl_real_t *dist)
 Calculates the change in distance based on initial velocity, time and acceleration. More...
 
int zsl_phy_kin_init_pos (zsl_real_t vi, zsl_real_t t, zsl_real_t a, zsl_real_t xf, zsl_real_t *xi)
 Calculates the initial position of a moving body based on the final position (xf), the initial velocity (vi), acceleration (a) and time (t). More...
 
int zsl_phy_kin_init_pos2 (zsl_real_t vi, zsl_real_t vf, zsl_real_t a, zsl_real_t xf, zsl_real_t *xi)
 Calculates the initial position of a moving body based on the final position (xf), the initial velocity (vi), the final velocity (vf) and acceleration (a). More...
 
int zsl_phy_kin_time (zsl_real_t vi, zsl_real_t vf, zsl_real_t accel, zsl_real_t *time)
 Calculates the time in seconds that it takes an object to change its velocity from vi to vf under a constant acceleration (accel). More...
 
int zsl_phy_kin_vel (zsl_real_t vi, zsl_real_t time, zsl_real_t accel, zsl_real_t *vf)
 Calculates the velocity in meters per second of an object under a constant acceleration (accel) based on its initial velocity (vi) and the time passed since it started moving (time). More...
 
int zsl_phy_kin_vel2 (zsl_real_t vi, zsl_real_t dist, zsl_real_t accel, zsl_real_t *vf)
 Calculates the velocity in meters per second of an object under a constant acceleration (accel) based on its initial velocity (vi) and the distance traveled from the starting point (dist). More...
 
int zsl_phy_kin_init_vel (zsl_real_t vf, zsl_real_t a, zsl_real_t t, zsl_real_t *vi)
 Calculates the initial velocity in meters per second of an object under a constant acceleration (a) based on its final velocity (vf) and time (t). More...
 
int zsl_phy_kin_init_vel2 (zsl_real_t dist, zsl_real_t a, zsl_real_t t, zsl_real_t *vi)
 Calculates the initial velocity in meters per second of an object under a constant acceleration (a) based on the distance it has travelled (dist) and time (t). More...
 
int zsl_phy_kin_init_vel3 (zsl_real_t vf, zsl_real_t a, zsl_real_t dist, zsl_real_t *vi)
 Calculates the initial velocity in meters per second of an object under a constant acceleration (a) based on the distance it has travelled (dist) and the final velocity (vf). More...
 
int zsl_phy_kin_av_vel (zsl_real_t dist, zsl_real_t time, zsl_real_t *vel)
 Calculates the average velocity in meters per second of a moving object based on the time and distance. More...
 
int zsl_phy_kin_accel (zsl_real_t vi, zsl_real_t vf, zsl_real_t time, zsl_real_t *accel)
 Calculates the acceleration of a moving body in meters per second squared based on its initial (vi) and final (vf) velocities and time. More...
 
int zsl_phy_kin_ener (zsl_real_t v, zsl_real_t m, zsl_real_t *ke)
 Calculates the kinetic energy in joules of a moving body based on its velocity (v) and mass (m). More...
 

Detailed Description

Kinematics functions.

Function Documentation

◆ zsl_phy_kin_accel()

int zsl_phy_kin_accel ( zsl_real_t  vi,
zsl_real_t  vf,
zsl_real_t  time,
zsl_real_t accel 
)

Calculates the acceleration of a moving body in meters per second squared based on its initial (vi) and final (vf) velocities and time.

Parameters
viInitial velocity in meters per second.
vfFinal velocity in meters per second.
timeTime in seconds.
accelPointer to the output acceleration in meters per second squared. Will be set to NAN if the time is negative or zero.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_av_vel()

int zsl_phy_kin_av_vel ( zsl_real_t  dist,
zsl_real_t  time,
zsl_real_t vel 
)

Calculates the average velocity in meters per second of a moving object based on the time and distance.

Parameters
distDistance in meters.
timeTime in seconds.
velPointer to the output velocity in meters per second. Will be set to NAN if the time is negative or zero.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_dist()

int zsl_phy_kin_dist ( zsl_real_t  vi,
zsl_real_t  time,
zsl_real_t  accel,
zsl_real_t dist 
)

Calculates the change in distance based on initial velocity, time and acceleration.

Parameters
viInitial velocity in meters per second.
timeTime in seconds.
accelAcceleration in meters per second squared.
distPointer to the placeholder for calculated distance in meters. Will be set to NAN if time is a negative value.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_ener()

int zsl_phy_kin_ener ( zsl_real_t  v,
zsl_real_t  m,
zsl_real_t ke 
)

Calculates the kinetic energy in joules of a moving body based on its velocity (v) and mass (m).

Parameters
vVelocity of the object in meters per second.
mMass of the object in kilograms.
kePointer to the output kinetic energy in joules. Will be set to NAN if the mass is negative.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_init_pos()

int zsl_phy_kin_init_pos ( zsl_real_t  vi,
zsl_real_t  t,
zsl_real_t  a,
zsl_real_t  xf,
zsl_real_t xi 
)

Calculates the initial position of a moving body based on the final position (xf), the initial velocity (vi), acceleration (a) and time (t).

Parameters
viInitial velocity in meters per second.
tTime in seconds.
aAcceleration in meters per second squared.
xfFinal position in meters.
xiPointer to the placeholder for the initial position in meters. Will be set to NAN if time is a negative value.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_init_pos2()

int zsl_phy_kin_init_pos2 ( zsl_real_t  vi,
zsl_real_t  vf,
zsl_real_t  a,
zsl_real_t  xf,
zsl_real_t xi 
)

Calculates the initial position of a moving body based on the final position (xf), the initial velocity (vi), the final velocity (vf) and acceleration (a).

Parameters
viInitial velocity in meters per second.
vfFinal velocity in meters per second.
aAcceleration in meters per second squared.
xfFinal position in meters.
xiPointer to the placeholder for the initial position in meters. Will be set to NAN if the acceleration's value is zero.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_init_vel()

int zsl_phy_kin_init_vel ( zsl_real_t  vf,
zsl_real_t  a,
zsl_real_t  t,
zsl_real_t vi 
)

Calculates the initial velocity in meters per second of an object under a constant acceleration (a) based on its final velocity (vf) and time (t).

Parameters
vfFinal velocity in meters per second.
aAcceleration in meters per second squared.
tTime in seconds.
viPointer to the output initial velocity in meters per second. Will be set to NAN if the time is negative.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_init_vel2()

int zsl_phy_kin_init_vel2 ( zsl_real_t  dist,
zsl_real_t  a,
zsl_real_t  t,
zsl_real_t vi 
)

Calculates the initial velocity in meters per second of an object under a constant acceleration (a) based on the distance it has travelled (dist) and time (t).

Parameters
distDistance in meters.
aAcceleration in meters per second squared.
tTime in seconds.
viPointer to the output initial velocity in meters per second. Will be set to NAN if the time is negative or zero.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_init_vel3()

int zsl_phy_kin_init_vel3 ( zsl_real_t  vf,
zsl_real_t  a,
zsl_real_t  dist,
zsl_real_t vi 
)

Calculates the initial velocity in meters per second of an object under a constant acceleration (a) based on the distance it has travelled (dist) and the final velocity (vf).

Parameters
vfFinal velocity in meters per second.
aAcceleration in meters per second squared.
distDistance in meters.
viPointer to the output initial velocity in meters per second. Will be set to NAN if the output velocity takes a complex value.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_time()

int zsl_phy_kin_time ( zsl_real_t  vi,
zsl_real_t  vf,
zsl_real_t  accel,
zsl_real_t time 
)

Calculates the time in seconds that it takes an object to change its velocity from vi to vf under a constant acceleration (accel).

Parameters
viInitial velocity in meters per second.
vfFinal velocity in meters per second.
accelAcceleration in meters per second squared.
timePointer to the placeholder for calculated time in seconds. Will be set to NAN if the time is negative or if the acceleration is zero.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_vel()

int zsl_phy_kin_vel ( zsl_real_t  vi,
zsl_real_t  time,
zsl_real_t  accel,
zsl_real_t vf 
)

Calculates the velocity in meters per second of an object under a constant acceleration (accel) based on its initial velocity (vi) and the time passed since it started moving (time).

Parameters
viInitial velocity in meters per second.
timeTime in seconds.
accelAcceleration in meters per second squared.
vfPointer to the output velocity in meters per second. Will be set to NAN if the time is negative.
Returns
0 on success, and non-zero error code on failure.

◆ zsl_phy_kin_vel2()

int zsl_phy_kin_vel2 ( zsl_real_t  vi,
zsl_real_t  dist,
zsl_real_t  accel,
zsl_real_t vf 
)

Calculates the velocity in meters per second of an object under a constant acceleration (accel) based on its initial velocity (vi) and the distance traveled from the starting point (dist).

Parameters
viInitial velocity in meters per second.
distDistance in meters.
accelAcceleration in meters per second squared.
vfPointer to the output velocity in meters per second. Will be set to NAN if the velocity takes a complex value.
Returns
0 on success, and non-zero error code on failure.