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
|
|
@ -17,7 +17,7 @@ public:
|
|||
{
|
||||
if ( m_context->restart == false )
|
||||
{
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Vec3_zero );
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Pos_zero );
|
||||
}
|
||||
|
||||
m_hull = nullptr;
|
||||
|
|
@ -112,10 +112,10 @@ public:
|
|||
|
||||
void Render() override
|
||||
{
|
||||
DrawHull( b3Transform_identity, m_hull, MakeColor( b3_colorYellow ) );
|
||||
DrawHull( b3Transform_identity, &m_box.base, MakeColor( b3_colorCyan ) );
|
||||
DrawHull( b3WorldTransform_identity, m_hull, MakeColor( b3_colorYellow ) );
|
||||
DrawHull( b3WorldTransform_identity, &m_box.base, MakeColor( b3_colorCyan ) );
|
||||
|
||||
DrawAxes( b3Transform_identity, 1.0f );
|
||||
DrawAxes( b3WorldTransform_identity, 1.0f );
|
||||
|
||||
Sample::Render();
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ public:
|
|||
{
|
||||
if ( m_context->restart == false )
|
||||
{
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Vec3_zero );
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Pos_zero );
|
||||
}
|
||||
|
||||
m_hull = nullptr;
|
||||
|
|
@ -209,10 +209,10 @@ public:
|
|||
{
|
||||
if ( m_hull != nullptr )
|
||||
{
|
||||
DrawHull( b3Transform_identity, m_hull, MakeColor( b3_colorYellow ) );
|
||||
DrawHull( b3WorldTransform_identity, m_hull, MakeColor( b3_colorYellow ) );
|
||||
}
|
||||
|
||||
DrawAxes( b3Transform_identity, 1.0f );
|
||||
DrawAxes( b3WorldTransform_identity, 1.0f );
|
||||
|
||||
Sample::Render();
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ public:
|
|||
{
|
||||
if ( m_context->restart == false )
|
||||
{
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Vec3_zero );
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Pos_zero );
|
||||
}
|
||||
|
||||
m_hull = nullptr;
|
||||
|
|
@ -335,12 +335,12 @@ public:
|
|||
{
|
||||
if ( m_hull != nullptr )
|
||||
{
|
||||
DrawHull( b3Transform_identity, m_hull, MakeColor( b3_colorYellow ) );
|
||||
DrawHull( b3WorldTransform_identity, m_hull, MakeColor( b3_colorYellow ) );
|
||||
|
||||
DrawTextLine( "v/f/e = %d/%d/%d", m_hull->vertexCount, m_hull->faceCount, m_hull->edgeCount / 2 );
|
||||
}
|
||||
|
||||
DrawAxes( b3Transform_identity, 1.0f );
|
||||
DrawAxes( b3WorldTransform_identity, 1.0f );
|
||||
|
||||
Sample::Render();
|
||||
}
|
||||
|
|
@ -367,7 +367,7 @@ public:
|
|||
{
|
||||
if ( m_context->restart == false )
|
||||
{
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Vec3_zero );
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Pos_zero );
|
||||
}
|
||||
|
||||
m_original = b3CreateCylinder( 1.0f, 0.5f, 0.0f, 9 );
|
||||
|
|
@ -406,9 +406,9 @@ public:
|
|||
b3Transform transform1 = { { -2.0f, 0.0f, 0.0f }, b3Quat_identity };
|
||||
b3Transform transform2 = { { 2.0f, 0.0f, 0.0f }, b3Quat_identity };
|
||||
|
||||
DrawHull( transform1, m_original, MakeColor( b3_colorGreen ) );
|
||||
DrawHull( transform2, m_hull, MakeColor( b3_colorYellow ) );
|
||||
DrawAxes( b3Transform_identity, 1.0f );
|
||||
DrawHull( b3MakeWorldTransform( transform1 ), m_original, MakeColor( b3_colorGreen ) );
|
||||
DrawHull( b3MakeWorldTransform( transform2 ), m_hull, MakeColor( b3_colorYellow ) );
|
||||
DrawAxes( b3WorldTransform_identity, 1.0f );
|
||||
|
||||
DrawTextLine( "hull 1: area = %g, volume = %g, radius = %g", m_original->surfaceArea, m_original->volume,
|
||||
m_original->innerRadius );
|
||||
|
|
@ -495,7 +495,7 @@ public:
|
|||
{
|
||||
if ( m_context->restart == false )
|
||||
{
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Vec3_zero );
|
||||
m_camera->SetView( 0.0f, 15.0f, 5.0f, b3Pos_zero );
|
||||
}
|
||||
|
||||
m_radius = 1.0f;
|
||||
|
|
@ -579,15 +579,15 @@ public:
|
|||
|
||||
void Render() override
|
||||
{
|
||||
DrawSolidCapsule( b3Transform_identity, m_capsule, MakeColorAlpha( b3_colorAqua, 0.8f ) );
|
||||
DrawHull( b3Transform_identity, &m_box.base, MakeColor( b3_colorBlueViolet ) );
|
||||
DrawSolidCapsule( b3WorldTransform_identity, m_capsule, MakeColorAlpha( b3_colorAqua, 0.8f ) );
|
||||
DrawHull( b3WorldTransform_identity, &m_box.base, MakeColor( b3_colorBlueViolet ) );
|
||||
|
||||
if ( m_hull != nullptr )
|
||||
{
|
||||
DrawHull( b3Transform_identity, m_hull, MakeColor( b3_colorYellow ) );
|
||||
DrawHull( b3WorldTransform_identity, m_hull, MakeColor( b3_colorYellow ) );
|
||||
}
|
||||
|
||||
DrawAxes( b3Transform_identity, 1.0f );
|
||||
DrawAxes( b3WorldTransform_identity, 1.0f );
|
||||
|
||||
if ( m_hull != nullptr )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue