Zephyr Scientific Library (zscilib)
Files | Functions
Center of mass

Center of mass functions. More...

Files

file  mass.h
 API header file for center of mass in zscilib.
 

Functions

int zsl_phy_mass_center (struct zsl_vec *m, struct zsl_vec *x, struct zsl_vec *y, struct zsl_vec *z, zsl_real_t *mx, zsl_real_t *my, zsl_real_t *mz)
 Calculates the three coordinate position of the center of mass of a set of objects given their masses and positions. More...
 

Detailed Description

Center of mass functions.

Function Documentation

◆ zsl_phy_mass_center()

int zsl_phy_mass_center ( struct zsl_vec m,
struct zsl_vec x,
struct zsl_vec y,
struct zsl_vec z,
zsl_real_t mx,
zsl_real_t my,
zsl_real_t mz 
)

Calculates the three coordinate position of the center of mass of a set of objects given their masses and positions.

Parameters
mVector that contains the mass of each object in kilograms.
xVector that contains the x coordinate of each object in meters.
yVector that contains the y coordinate of each object in meters.
zVector that contains the z coordinate of each object in meters.
mxPointer to the x position of the center of mass in meters.
myPointer to the y position of the center of mass in meters.
mzPointer to the z position of the center of mass in meters.
Returns
0 if everything executed properly, -EINVAL if any of the masses has a negative value or the total mass is zero.