Compile Newton using double precision?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Compile Newton using double precision?

Postby pwagner » Thu Jun 30, 2011 6:58 am

Hey.

I'm stuck at the following task: How do I compile the library using double precision? I found out that dFloat (at least it is a typedef for float or double using the defined constant __USE_DOUBLE_PRECISION__) would be a good start but I can't get it to work. Maybe you have the solution? I'm asking because I recognized a pattern which looks like integer overflow and I hope to get rid of it by using higher precision. The phenomenon can be observed by simply set up a world with a sphere shaped body and a force callback applying every timestep a gravitation of -9.81 m/s^2. The oscillation in position of the body will appear after 4.51 seconds and gets even worse after 14.27 seconds of simulated time.
Maybe you have a clue where this comes from and how to get rid of it?

Best regards.
pwagner
 
Posts: 13
Joined: Wed Apr 06, 2011 3:14 am

Re: Compile Newton using double precision?

Postby JernejL » Fri Jul 01, 2011 3:39 am

which integrator did you use?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compile Newton using double precision?

Postby pwagner » Fri Jul 01, 2011 7:50 am

I used the default solver, or at least I did not changed it by calling NewtonSetSolverModel because I need the best accuracy I can get.

Setup looks like:
Code: Select all
world = NewtonCreate();
float min[3] = {-500., -3000., -200.};
float max[3] = {500., 200., 200.};
NewtonSetWorldSize(world, min, max);


But I could try another model as you mention it.
[Edit]Tried but lead to the same results. Jitter and general error![/Edit]
pwagner
 
Posts: 13
Joined: Wed Apr 06, 2011 3:14 am

Re: Compile Newton using double precision?

Postby JernejL » Sat Jul 02, 2011 7:00 am

what you describe seems impossible, what's the mass and size of that sphere?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compile Newton using double precision?

Postby pwagner » Mon Jul 04, 2011 1:51 am

The mass and radius of the sphere are set as 1.

Code: Select all
float radius = 1.;
float mass = 1. / 1.;
dVector inertia;

dMatrix offset = GetIdentityMatrix();
offset.m_posit = dVector(0., 0., 0., 1.);
ballShape = NewtonCreateSphere(world, radius, radius, radius, --shapeId, &offset[0][0]);

dMatrix origin = GetIdentityMatrix();
origin.m_posit = dVector(0., 0., 0., 1.);
ballBody = NewtonCreateBody(world, ballShape, &origin[0][0]);

NewtonConvexCollisionCalculateInertialMatrix(ballShape, &inertia[0], &origin[0][0]);
NewtonBodySetMassMatrix(ballBody, mass, mass * inertia.m_x, mass * inertia.m_y, mass * inertia.m_z);
NewtonBodySetCentreOfMass(ballBody, &origin[0][0]);
NewtonBodySetLinearDamping(ballBody, 0.f);

NewtonBodySetForceAndTorqueCallback (ballBody, ForceAndTorqueCallback);

NewtonReleaseCollision(world, ballShape);


I will try to upload some pictures to show you the phenomenon in the meanwhile the code above should do.
pwagner
 
Posts: 13
Joined: Wed Apr 06, 2011 3:14 am

Re: Compile Newton using double precision?

Postby pwagner » Fri Jul 08, 2011 5:12 am

So could you reproduce the strange behavior?

And I'm still interested in how I can compile Newton using double precision!

Best regards.
pwagner
 
Posts: 13
Joined: Wed Apr 06, 2011 3:14 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest