#include <substance.h>
Public Member Functions | |
Substance () | |
Substance (float roughness, float slip, float hardness, float elasticity) | |
void | setCollisionCallback (CollisionCallback func, void *userdata) |
void | toDefaultSubstance () |
void | toMetal (float roughness) |
very hard and elastic with slip roughness [0.1-1] | |
void | toRubber (float hardness) |
high roughness, no slip, very elastic, hardness : [5-50] | |
void | toPlastic (float roughness) |
medium slip, a bit elastic, medium hardness, roughness [0.5-2] | |
void | toFoam (float _hardness) |
large slip, not elastic, low hardness [1-30], high roughness | |
void | toSnow (float _slip) |
variable slip and roughness, not elastic, high hardness for solid snow slip = 1 <--> roughness=0.0, slip = 0 <--> roughnes=1.0 | |
void | toNoContact () |
collsion callback that ignores everything Usually it is better to use the "ignorePairs" from odeHandle but if this particular one should not collide with any, this is easier. | |
Static Public Member Functions | |
static void | getSurfaceParams (dSurfaceParameters &sp, const Substance &s1, const Substance &s2, double stepsize) |
Combination of two surfaces. | |
static void | printSurfaceParams (const dSurfaceParameters &surfParams) |
static Substance | getDefaultSubstance () |
default substance is plastic with roughness=0.8 | |
static Substance | getMetal (float roughness) |
very hard and elastic with slip roughness [0.1-1] | |
static Substance | getRubber (float hardness) |
high roughness, no slip, very elastic, hardness : [5-50] | |
static Substance | getPlastic (float roughness) |
medium slip, a bit elastic, medium hardness, roughness [0.5-2] | |
static Substance | getFoam (float _hardness) |
large slip, not elastic, low hardness [1-30], high roughness | |
static Substance | getSnow (float _slip) |
variable slip and roughness [0-1], not elastic, high hardness for solid snow slip = 1 <--> roughness=0.0, slip = 0 <--> roughnes=1.0 | |
static Substance | getNoContact () |
Public Attributes | |
float | roughness |
float | slip |
float | hardness |
float | elasticity |
CollisionCallback | callback |
void * | userdata |
Parameter interval collision_parameter roughness: [0-] mu = roughness1*roughness2 slip: [0-] slip = slip1+slip2 hardness: [0-] kp = hardness1 * hardness2 / (hardness1 + hardness2) (two springs serial) elasticity: [0-1] kd = (1-elasticity1) * s2.hardness + (1-elasticity2) * s1.hardness) / (s1.hardness + s2.hardness);For the calculation of the spring/damping constant we use the following schema: The collision can be considered as 2 springs serially connected. The spring constant of each collision side is given by hardness (here kp). The spring constant of the entire spring is given by
. The damping (kd) is derived from the elasticity (e), but it is more difficult to compute. Consider the damping in form of energy lost. We can write the energy or work done by each spring as:
with
. The energy lost though damping is
. The final damping is now:
.
Todo: maybe add bounce
Substance | ( | ) |
Substance | ( | float | roughness, | |
float | slip, | |||
float | hardness, | |||
float | elasticity | |||
) |
Substance getDefaultSubstance | ( | ) | [static] |
default substance is plastic with roughness=0.8
Substance getFoam | ( | float | _hardness | ) | [static] |
large slip, not elastic, low hardness [1-30], high roughness
Substance getMetal | ( | float | roughness | ) | [static] |
very hard and elastic with slip roughness [0.1-1]
Substance getNoContact | ( | ) | [static] |
Substance getPlastic | ( | float | roughness | ) | [static] |
medium slip, a bit elastic, medium hardness, roughness [0.5-2]
Substance getRubber | ( | float | hardness | ) | [static] |
high roughness, no slip, very elastic, hardness : [5-50]
Substance getSnow | ( | float | _slip | ) | [static] |
variable slip and roughness [0-1], not elastic, high hardness for solid snow slip = 1 <--> roughness=0.0, slip = 0 <--> roughnes=1.0
void getSurfaceParams | ( | dSurfaceParameters & | sp, | |
const Substance & | s1, | |||
const Substance & | s2, | |||
double | stepsize | |||
) | [static] |
Combination of two surfaces.
void printSurfaceParams | ( | const dSurfaceParameters & | surfParams | ) | [static] |
void setCollisionCallback | ( | CollisionCallback | func, | |
void * | userdata | |||
) |
void toDefaultSubstance | ( | ) |
void toFoam | ( | float | _hardness | ) |
large slip, not elastic, low hardness [1-30], high roughness
void toMetal | ( | float | roughness | ) |
very hard and elastic with slip roughness [0.1-1]
void toNoContact | ( | ) |
collsion callback that ignores everything Usually it is better to use the "ignorePairs" from odeHandle but if this particular one should not collide with any, this is easier.
WARNING: this sets the collisionCallback. This will not convert to other substances without manually setting the callback to 0
void toPlastic | ( | float | roughness | ) |
medium slip, a bit elastic, medium hardness, roughness [0.5-2]
void toRubber | ( | float | hardness | ) |
high roughness, no slip, very elastic, hardness : [5-50]
void toSnow | ( | float | _slip | ) |
variable slip and roughness, not elastic, high hardness for solid snow slip = 1 <--> roughness=0.0, slip = 0 <--> roughnes=1.0
float elasticity |
float hardness |
float roughness |
float slip |
void* userdata |