|
Nudge Physics
A single file, header-only 3D physics library
|
Set of helper functions that just wrap existing functions. More...
Functions | |
| unsigned | nudge::extra::add_compound_prism (context_t *c, float mass, float radius, float hheight, unsigned num_lateral_faces=0, const Transform *T=NULL, AxisEnum axis=AXIS_Y, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents a prism of 4 or more lateral faces. | |
| unsigned | nudge::extra::add_compound_prism (context_t *c, float mass, float radius, float hheight, unsigned num_lateral_faces, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, const float comOffset[3]=NULL) |
| unsigned | nudge::extra::add_compound_cylinder (context_t *c, float mass, float radius, float hheight, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=0, unsigned num_spheres=0, const float comOffset[3]=NULL, float box_lateral_side_shrinking=-1.f) |
| Adds a new body to the simulation with a compound collider that represents a cylinder. | |
| unsigned | nudge::extra::add_compound_cylinder (context_t *c, float mass, float radius, float hheight, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=0, unsigned num_spheres=0, const float comOffset[3]=NULL, float box_lateral_side_shrinking=-1.f) |
| unsigned | nudge::extra::add_compound_capsule (context_t *c, float mass, float radius, float hheight, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=1, unsigned num_spheres=3, const float comOffset[3]=NULL, float box_lateral_side_shrinking=-1.f) |
| Adds a new body to the simulation with a compound collider that represents a capsule. | |
| unsigned | nudge::extra::add_compound_capsule (context_t *c, float mass, float radius, float hheight, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=1, unsigned num_spheres=3, const float comOffset[3]=NULL, float box_lateral_side_shrinking=-1.f) |
| unsigned | nudge::extra::add_compound_hollow_cylinder (context_t *c, float mass, float min_radius, float max_radius, float hheight, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=8, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents the hollow lateral surface of a cylinder. | |
| unsigned | nudge::extra::add_compound_hollow_cylinder (context_t *c, float mass, float min_radius, float max_radius, float hheight, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=8, const float comOffset[3]=NULL) |
| unsigned | nudge::extra::add_compound_torus (context_t *c, float mass, float radius, float inner_radius, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=8, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents a torus. | |
| unsigned | nudge::extra::add_compound_torus (context_t *c, float mass, float radius, float inner_radius, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=8, const float comOffset[3]=NULL) |
| unsigned | nudge::extra::add_compound_cone (context_t *c, float mass, float radius, float hheight, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=0, unsigned num_spheres=0, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents an approximated cone. | |
| unsigned | nudge::extra::add_compound_cone (context_t *c, float mass, float radius, float hheight, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=0, unsigned num_spheres=0, const float comOffset[3]=NULL) |
| unsigned | nudge::extra::add_compound_staircase (context_t *c, float mass, float hdepth, float hheight, float hlength, unsigned num_steps=15, const Transform *T=NULL, int orientation_in_0_3=0, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents a staircase; please note that the inertia is not calculated (or even approximated) correctly (only relevant when used as dynamic body) | |
| unsigned | nudge::extra::add_compound_staircase (context_t *c, float mass, float hdepth, float hheight, float hlength, unsigned num_steps, const float *mMatrix16WithoutScaling, int orientation_in_0_3=0, const float comOffset[3]=NULL) |
Set of helper functions that just wrap existing functions.
| unsigned nudge::extra::add_compound_prism | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | hheight, | ||
| unsigned | num_lateral_faces = 0, |
||
| const Transform * | T = NULL, |
||
| AxisEnum | axis = AXIS_Y, |
||
| const float | comOffset[3] = NULL |
||
| ) |
Adds a new body to the simulation with a compound collider that represents a prism of 4 or more lateral faces.
| c | the nudge context |
| mass | positive => dynamic; 0 => static; negative => kinematic (where the absolute value will be used as mass internally) |
| radius | the radius of the cylinder inscribed into the prism (the prism covers all the inscribed cylinder); please use (radius*cosf(M_PI/num_lateral_faces)) as radius for a prism that is entirely covered by the cylinder of radius: radius |
| hheight | the half height of the prism |
| num_lateral_faces | the number of lateral faces of the prism (must be >=4) |
| T | a pointer to a Transform |
| axis | one of the AXIS_X,AXIS_Y,AXIS_Z values |
| comOffset | an optional array of 3 floats that determines the center of mass offset of the body |
| unsigned nudge::extra::add_compound_prism | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | hheight, | ||
| unsigned | num_lateral_faces, | ||
| const float * | mMatrix16WithoutScaling, | ||
| AxisEnum | axis = AXIS_Y, |
||
| const float | comOffset[3] = NULL |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| mMatrix16WithoutScaling | a pointer to a 4x4 column-major matrix with only translation and rotation |
| unsigned nudge::extra::add_compound_cylinder | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | hheight, | ||
| const Transform * | T = NULL, |
||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 0, |
||
| unsigned | num_spheres = 0, |
||
| const float | comOffset[3] = NULL, |
||
| float | box_lateral_side_shrinking = -1.f |
||
| ) |
Adds a new body to the simulation with a compound collider that represents a cylinder.
| c | the nudge context |
| mass | positive => dynamic; 0 => static; negative => kinematic (where the absolute value will be used as mass internally) |
| radius | the radius of the cylinder |
| hheight | the half height of the cylinder |
| T | a pointer to a Transform |
| axis | one of the AXIS_X,AXIS_Y,AXIS_Z values |
| num_boxes | the number of boxes to consume (0 is replaced by some predefined value) |
| num_spheres | the number of spheres to consume (0 is replaced by some predefined value) |
| comOffset | an optional array of 3 floats that determines the center of mass offset of the body |
| box_lateral_side_shrinking | constant to tune how much the lateral half size of the box(es) is smaller than radius of the spheres (default value of -1 is replaced by some predefined value) |
| unsigned nudge::extra::add_compound_cylinder | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | hheight, | ||
| const float * | mMatrix16WithoutScaling, | ||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 0, |
||
| unsigned | num_spheres = 0, |
||
| const float | comOffset[3] = NULL, |
||
| float | box_lateral_side_shrinking = -1.f |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| mMatrix16WithoutScaling | a pointer to a 4x4 column-major matrix with only translation and rotation |
| unsigned nudge::extra::add_compound_capsule | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | hheight, | ||
| const Transform * | T = NULL, |
||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 1, |
||
| unsigned | num_spheres = 3, |
||
| const float | comOffset[3] = NULL, |
||
| float | box_lateral_side_shrinking = -1.f |
||
| ) |
Adds a new body to the simulation with a compound collider that represents a capsule.
| c | the nudge context |
| mass | positive => dynamic; 0 => static; negative => kinematic (where the absolute value will be used as mass internally) |
| radius | the radius of the capsule |
| hheight | the half height of the cylinder that compose the capsule (if it's zero, then the capsule becomes a sphere) |
| T | a pointer to a Transform |
| axis | one of the AXIS_X,AXIS_Y,AXIS_Z values |
| num_boxes | the number of boxes to consume (0 is replaced by some predefined value) |
| num_spheres | the number of spheres to consume (0 is replaced by some predefined value) |
| comOffset | an optional array of 3 floats that determines the center of mass offset of the body |
| box_lateral_side_shrinking | constant to tune how much the lateral half size of the box(es) is smaller than radius of the spheres (default value of -1 is replaced by some predefined value) |
| unsigned nudge::extra::add_compound_capsule | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | hheight, | ||
| const float * | mMatrix16WithoutScaling, | ||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 1, |
||
| unsigned | num_spheres = 3, |
||
| const float | comOffset[3] = NULL, |
||
| float | box_lateral_side_shrinking = -1.f |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| mMatrix16WithoutScaling | a pointer to a 4x4 column-major matrix with only translation and rotation |
| unsigned nudge::extra::add_compound_hollow_cylinder | ( | context_t * | c, |
| float | mass, | ||
| float | min_radius, | ||
| float | max_radius, | ||
| float | hheight, | ||
| const Transform * | T = NULL, |
||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 8, |
||
| const float | comOffset[3] = NULL |
||
| ) |
Adds a new body to the simulation with a compound collider that represents the hollow lateral surface of a cylinder.
| c | the nudge context |
| mass | positive => dynamic; 0 => static; negative => kinematic (where the absolute value will be used as mass internally) |
| min_radius | the minimum radius that starts at the center of the cylinder |
| max_radius | the maximum radius that starts at the center of the cylinder (the whole depth is: max_radius - min_radius) |
| hheight | the half height of the cylinder |
| T | a pointer to a Transform |
| axis | one of the AXIS_X,AXIS_Y,AXIS_Z values |
| num_boxes | the number of boxes to consume (0 is replaced by some predefined value) |
| comOffset | an optional array of 3 floats that determines the center of mass offset of the body |
| unsigned nudge::extra::add_compound_hollow_cylinder | ( | context_t * | c, |
| float | mass, | ||
| float | min_radius, | ||
| float | max_radius, | ||
| float | hheight, | ||
| const float * | mMatrix16WithoutScaling, | ||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 8, |
||
| const float | comOffset[3] = NULL |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| mMatrix16WithoutScaling | a pointer to a 4x4 column-major matrix with only translation and rotation |
| unsigned nudge::extra::add_compound_torus | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | inner_radius, | ||
| const Transform * | T = NULL, |
||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 8, |
||
| const float | comOffset[3] = NULL |
||
| ) |
Adds a new body to the simulation with a compound collider that represents a torus.
| c | the nudge context |
| mass | positive => dynamic; 0 => static; negative => kinematic (where the absolute value will be used as mass internally) |
| radius | the radius that starts at the origin of the shape and ends in the middle of the rotational donut-like solid |
| inner_radius | the internal radius of the donut-like solid (so that maximum_radius = radius + inner_radius represent the maximum radius of the shape, starting at its origin) |
| T | a pointer to a Transform |
| axis | one of the AXIS_X,AXIS_Y,AXIS_Z values |
| num_boxes | the number of boxes to consume (0 is replaced by some predefined value) |
| comOffset | an optional array of 3 floats that determines the center of mass offset of the body |
| unsigned nudge::extra::add_compound_torus | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | inner_radius, | ||
| const float * | mMatrix16WithoutScaling, | ||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 8, |
||
| const float | comOffset[3] = NULL |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| mMatrix16WithoutScaling | a pointer to a 4x4 column-major matrix with only translation and rotation |
| unsigned nudge::extra::add_compound_cone | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | hheight, | ||
| const Transform * | T = NULL, |
||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 0, |
||
| unsigned | num_spheres = 0, |
||
| const float | comOffset[3] = NULL |
||
| ) |
Adds a new body to the simulation with a compound collider that represents an approximated cone.
| c | the nudge context |
| mass | positive => dynamic; 0 => static; negative => kinematic (where the absolute value will be used as mass internally) |
| radius | the radius of the cone |
| hheight | the half height of the cone |
| T | a pointer to a Transform |
| axis | one of the AXIS_X,AXIS_Y,AXIS_Z values |
| num_boxes | the number of boxes to consume (0 is replaced by some predefined value) |
| num_spheres | the number of spheres to consume (0 is replaced by some predefined value) |
| comOffset | an optional array of 3 floats that determines the center of mass offset of the body |
| unsigned nudge::extra::add_compound_cone | ( | context_t * | c, |
| float | mass, | ||
| float | radius, | ||
| float | hheight, | ||
| const float * | mMatrix16WithoutScaling, | ||
| AxisEnum | axis = AXIS_Y, |
||
| unsigned | num_boxes = 0, |
||
| unsigned | num_spheres = 0, |
||
| const float | comOffset[3] = NULL |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| mMatrix16WithoutScaling | a pointer to a 4x4 column-major matrix with only translation and rotation |
| unsigned nudge::extra::add_compound_staircase | ( | context_t * | c, |
| float | mass, | ||
| float | hdepth, | ||
| float | hheight, | ||
| float | hlength, | ||
| unsigned | num_steps = 15, |
||
| const Transform * | T = NULL, |
||
| int | orientation_in_0_3 = 0, |
||
| const float | comOffset[3] = NULL |
||
| ) |
Adds a new body to the simulation with a compound collider that represents a staircase; please note that the inertia is not calculated (or even approximated) correctly (only relevant when used as dynamic body)
| c | the nudge context |
| mass | positive => dynamic; 0 => static; negative => kinematic (where the absolute value will be used as mass internally) |
| hdepth | the half depth of the staircase |
| hheight | the half height of the staircase |
| hlength | the half length of the staircase |
| num_steps | the number of the steps and of the boxes to consume (0 is replaced by some predefined value) |
| T | a pointer to a Transform |
| orientation_in_0_3 | the height of the staircase is always aligned to AXIS_Y: if orientation_in_0_3==0 the front of the staircase is along +AXIS_Z; successive values rotate it of 90 degrees clockwise |
| comOffset | an optional array of 3 floats that determines the center of mass offset of the body |
| unsigned nudge::extra::add_compound_staircase | ( | context_t * | c, |
| float | mass, | ||
| float | hdepth, | ||
| float | hheight, | ||
| float | hlength, | ||
| unsigned | num_steps, | ||
| const float * | mMatrix16WithoutScaling, | ||
| int | orientation_in_0_3 = 0, |
||
| const float | comOffset[3] = NULL |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| mMatrix16WithoutScaling | a pointer to a 4x4 column-major matrix with only translation and rotation |