Double-precision interfaces for Minie

Is anyone using one of the double-precision (“Dp”) Minie libraries? I’m thinking about improving Minie’s support for double precision and would appreciate some input…

2 Likes

I use it for large sever side ridged body simulation. Mostly so that the coordinates align with the rest of the server. I’m not doing anything more complex than that at the moment.

2 Likes

sorry i still haven’t delved into this topic

1 Like

I’m not using double precision yet.

1 Like

Would it be beneficial to be able to read the location of a rigid body in double precision, i.e. as a com.simsilica.mathd.Vec3d value?

For me, yes, it would. I am using Minie with SimEthereal library which is using com.simsilica.mathd. Having Minie supports mathd, I can get rid of the float to double (and vice-vers) Vector/Quaternion conversion on the physics system from the server.

1 Like

Which of the following methods do you use:

  • PhysicsCollisionObject.getPhysicsLocation()
  • PhysicsCollisionObject.getTransform()
  • RigidBodyMotionState.getLocation()
  • RigidBodyMotionState.physicsTransform()

?

I use

PhysicsCollisionObject.getPhysicsLocation()

1 Like

DP is very important for real-time simulations. Using float will produce too many rounding errors and questionable values.

1 Like

Please elaborate. What sort real-time simulations do you have in mind?

Unigine is at first a real time engine and uses dp. When you look at their website you get an idea why they use dp.

It is true that only for gaming dp is not really needed because you can or have fake physics.

In Unity i tried to model the human speed and acceleration for a sport simulation using real values(speed = forwardVector(N) * speed * Time.deltaTime). To have nice looking results i had to adjust values. So a runner could achieve perhaps 35 km/h (top speed) → m/s (around 9 - 10). After many tests i had to reduce the real values (because of rounding errors).

Offering dp could be an attractive option for Jave developers outside the classical gaming world.

1 Like

Perhaps I was unclear.

Minie already offers double-precision integration of velocities and positions, through “dp”-flavored libraries such as “Minie-4.3.0+dp”. However, that precision was (until yesterday) purely internal to the physics simulation. The Minie API returned locations in single-precision, as Vector3f values. There was no way to get (or set) the position of a physics object in double precision.

I was asking whether there’s a need for such access.

Since @Ali_RS identified a need, I went ahead and added 8 double-precision accessors to MInie:

  • PhysicsCollisionObject.getPhysicsLocationDp()
  • PhysicsCollisionObject.getPhysicsRotationDp()
  • PhysicsRigidBody.getAngularVelocityDp()
  • PhysicsRigidBody.getLinearVelocityDp()
  • PhysicsRigidBody.setAngularVelocityDp()
  • PhysicsRigidBody.setLinearVelocityDp()
  • PhysicsRigidBody.setPhysicsLocationDp()
  • PhysicsRigidBody.setPhysicsRotationDp()

I plan to include these accessors in the next release of Minie, which will probably be designated v4.4 .

Now that the native data conversions are working, it should be easy to further expand the API along these lines. Forces, impulses, and torques could be specified in DP. Parameters such as friction, gravity, and restitution could be made accessible. Collision shapes could be generated in DP. Contact-test and ray-test results could be reported in DP.

Further experience with DP may reveal which, if any, of these features might prove useful in practice.

4 Likes

Thank you @sgold :slightly_smiling_face:

1 Like

Minie v4.4.0 has been released!

The new release has a dependency on v1.4.1 of Paul’s SimMath library, which isn’t available from JCenter MavenCentral. So you might need to add something like this to your Gradle build scripts:

repositories {
    maven { url 'https://jcenter.bintray.com' } // for SimMath
}

Documentation should be updated later today.

3 Likes

Is there a typo here? isn’t = is only OR Jcenter = maven central?

1 Like

Yup. I corrected my previous post. Thanks!