Nudge Physics
A single file, header-only 3D physics library
Loading...
Searching...
No Matches
Inertia Calculation Functions

Helper functions to calculate the inertia vector of a body (to feed add_compound(...)), or its inverse (to feed c->bodies.properties[body].inertia_inverse directly) More...

Functions

void nudge::calculate_box_inertia (float result[3], float mass, float hsizex, float hsizey, float hsizez, const float comOffset[3]=NULL)
 
void nudge::calculate_sphere_inertia (float result[3], float mass, float radius, const float comOffset[3]=NULL, bool hollow=false)
 
void nudge::calculate_cylinder_inertia (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void nudge::calculate_capsule_inertia (float result[3], float mass, float radius, float halfCylinderHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void nudge::calculate_torus_inertia (float result[3], float mass, float majorRadius, float minorRadius, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void nudge::calculate_hollow_cylinder_inertia (float result[3], float mass, float R, float r, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void nudge::calculate_cone_inertia (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void nudge::calculate_box_inertia_inverse (float result[3], float mass, float hsizex, float hsizey, float hsizez, const float comOffset[3]=NULL)
 
void nudge::calculate_sphere_inertia_inverse (float result[3], float mass, float radius, const float comOffset[3]=NULL, bool hollow=false)
 
void nudge::calculate_cylinder_inertia_inverse (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void nudge::calculate_capsule_inertia_inverse (float result[3], float mass, float radius, float halfCylinderHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void nudge::calculate_torus_inertia_inverse (float result[3], float mass, float majorRadius, float minorRadius, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void nudge::calculate_hollow_cylinder_inertia_inverse (float result[3], float mass, float R, float r, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void nudge::calculate_cone_inertia_inverse (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 

Detailed Description

Helper functions to calculate the inertia vector of a body (to feed add_compound(...)), or its inverse (to feed c->bodies.properties[body].inertia_inverse directly)

Function Documentation

◆ calculate_box_inertia()

void nudge::calculate_box_inertia ( float  result[3],
float  mass,
float  hsizex,
float  hsizey,
float  hsizez,
const float  comOffset[3] = NULL 
)

◆ calculate_sphere_inertia()

void nudge::calculate_sphere_inertia ( float  result[3],
float  mass,
float  radius,
const float  comOffset[3] = NULL,
bool  hollow = false 
)

◆ calculate_cylinder_inertia()

void nudge::calculate_cylinder_inertia ( float  result[3],
float  mass,
float  radius,
float  halfHeight,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)

◆ calculate_capsule_inertia()

void nudge::calculate_capsule_inertia ( float  result[3],
float  mass,
float  radius,
float  halfCylinderHeight,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)

◆ calculate_torus_inertia()

void nudge::calculate_torus_inertia ( float  result[3],
float  mass,
float  majorRadius,
float  minorRadius,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)

◆ calculate_hollow_cylinder_inertia()

void nudge::calculate_hollow_cylinder_inertia ( float  result[3],
float  mass,
float  R,
float  r,
float  halfHeight,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)

◆ calculate_cone_inertia()

void nudge::calculate_cone_inertia ( float  result[3],
float  mass,
float  radius,
float  halfHeight,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)

◆ calculate_box_inertia_inverse()

void nudge::calculate_box_inertia_inverse ( float  result[3],
float  mass,
float  hsizex,
float  hsizey,
float  hsizez,
const float  comOffset[3] = NULL 
)

◆ calculate_sphere_inertia_inverse()

void nudge::calculate_sphere_inertia_inverse ( float  result[3],
float  mass,
float  radius,
const float  comOffset[3] = NULL,
bool  hollow = false 
)

◆ calculate_cylinder_inertia_inverse()

void nudge::calculate_cylinder_inertia_inverse ( float  result[3],
float  mass,
float  radius,
float  halfHeight,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)

◆ calculate_capsule_inertia_inverse()

void nudge::calculate_capsule_inertia_inverse ( float  result[3],
float  mass,
float  radius,
float  halfCylinderHeight,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)

◆ calculate_torus_inertia_inverse()

void nudge::calculate_torus_inertia_inverse ( float  result[3],
float  mass,
float  majorRadius,
float  minorRadius,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)

◆ calculate_hollow_cylinder_inertia_inverse()

void nudge::calculate_hollow_cylinder_inertia_inverse ( float  result[3],
float  mass,
float  R,
float  r,
float  halfHeight,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)

◆ calculate_cone_inertia_inverse()

void nudge::calculate_cone_inertia_inverse ( float  result[3],
float  mass,
float  radius,
float  halfHeight,
AxisEnum  upAxis = AXIS_Y,
const float  comOffset[3] = NULL 
)