Doubles (#14)
Added a compile time option to use double precision body positions. Most math remains single precision with minimal performance loss. `BOX3D_DOUBLE_PRECISION` Improved accuracy of body inertia computation when shapes are far from the body origin. WARNING: several APIs changed but migration should be straight forward if doubles are not enabled.
This commit is contained in:
parent
a252f03b19
commit
09c65b08ea
115 changed files with 7591 additions and 5295 deletions
|
|
@ -22,11 +22,12 @@ static int ShapeMassTest( void )
|
|||
float mass = 4.0f / 3.0f * B3_PI;
|
||||
ENSURE_SMALL( md.mass - mass, FLT_EPSILON );
|
||||
ENSURE( md.center.x == 1.0f && md.center.y == 0.0f );
|
||||
|
||||
// Inertia is now about the shape center of mass, so the offset does not appear.
|
||||
float inertia = 2.0f / 5.0f * mass;
|
||||
float offsetInertia = inertia + mass;
|
||||
ENSURE_SMALL( md.inertia.cx.x - inertia, FLT_EPSILON );
|
||||
ENSURE_SMALL( md.inertia.cy.y - offsetInertia, FLT_EPSILON );
|
||||
ENSURE_SMALL( md.inertia.cz.z - offsetInertia, FLT_EPSILON );
|
||||
ENSURE_SMALL( md.inertia.cy.y - inertia, FLT_EPSILON );
|
||||
ENSURE_SMALL( md.inertia.cz.z - inertia, FLT_EPSILON );
|
||||
}
|
||||
|
||||
// Analytic box hull
|
||||
|
|
|
|||
Loading…
Reference in a new issue