A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Stucuk » Thu Mar 29, 2012 8:05 pm
How do you compile with double precision? I am not very familiar with Visual Studio, but from what i can tell there is no nice way to tell Visual Studio to globally define stuff(In Delphi its simple, just add your "conditional defines" to a list in the projects options).
-

Stucuk
-
- Posts: 801
- Joined: Sat Mar 12, 2005 3:54 pm
- Location: Scotland
-
by Julio Jerez » Fri Mar 30, 2012 8:18 am
I have not try double precision in core 300 yet. I can try this weekend it sould be simple
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Stucuk » Fri Mar 30, 2012 10:18 am
My question applies to Core 200 as well. The latest Core 200 doesn't contain a Double Precision DLL. I am resurrecting the Breakout Style game i was making in 2010, which was designed for double precision (And uses 2.24 . Most of the game should be able to work with Single Precision but there may be bits which won't).
I can compile single precision(Core 200, not tried Core 300), i just don't know how to globally define __USE_DOUBLE_PRECISION__ in Visual Studio. Without resorting to manually defining it in every unit anyway.
-

Stucuk
-
- Posts: 801
- Joined: Sat Mar 12, 2005 3:54 pm
- Location: Scotland
-
by Julio Jerez » Fri Mar 30, 2012 11:57 am
Oh I see, ther is a define that compile teh code in double, it should still work because I never changed.
This week end I am uploading a next alpha for newtopn 300, there some monor bug fix in core 200 so put 237, and I will build all of the DLLs,
to defined a global const in vidusl studio, do this.
right click on the explorer project and go to the c/c++ you will see the preprossero definition., but you can just wait until I pu the new dlls.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Stucuk » Fri Mar 30, 2012 7:03 pm
Ahh Thanks.
-

Stucuk
-
- Posts: 801
- Joined: Sat Mar 12, 2005 3:54 pm
- Location: Scotland
-
by nicokruithof » Tue Dec 03, 2013 3:31 am
Hi,
I'm trying to build newton in double precision. I defined __USE_DOUBLE_PRECISION__, which makes the dFloat32 and dgFloat64 a double. That resulted in compiler errors because of doubly defined functions. I can send you the diff if you want. Things compile now and the integrator works fine. I still have trouble with the collision geometry.
Is this the way to go? It would be fine for me to keep the collision detection in floats while moving the integrator to doubles. Would that be an option?
Bests,
Nico
-
nicokruithof
-
- Posts: 14
- Joined: Tue Dec 03, 2013 3:25 am
by Julio Jerez » Tue Dec 03, 2013 9:07 am
It has being a long time that I do no compile in double precision, what error did you get with collision?
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by nicokruithof » Tue Dec 03, 2013 10:02 am
I posted the diff with the changes I made to compile newton with doubles at:
http://www.nghk.nl/newton_in_double.patchThe diff is for the svn-trunk. I've changed the vector class to handle doubles. The bitmasks were hardcoded for floats.
I do see the collision geometry in my debug visualization window now, but newton doesn't detect any collisions. For collisions I use the collision mesh (static) and convex collision geometry. A screenshot of the collision can be seen at:
www.nghk.nl/newton_collision.png
-
nicokruithof
-
- Posts: 14
- Joined: Tue Dec 03, 2013 3:25 am
by Julio Jerez » Tue Dec 03, 2013 11:43 am
would the level work with single precision? the image look small enough?
what do you mean "The bitmasks were hardcoded for floats"
I see if I can enable the double precision over the weekend, I am in the model of a large update now to merge that patch.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by nicokruithof » Tue Dec 03, 2013 12:56 pm
I didn't test with the latest svn version, but the latest released version did work fine with floats. I assume that the latest version will work as well. I can test it at the office tomorrow.
When the collision tree is build, it creates bounding boxes. To remove the homogeneous coordinate from a 3D vector a bitwise & is done with a bitmask 0xffffffff,0xffffffff,0xffffffff,0x0. For doubles the mask should be twice as long. There are other operations defined on the 3D vector as well.
There were also some doubly defined functions (because both dgFloat32 and dgFloat64 are both doubles). I changed their signature to use float and double instead.
I also tested with bigger collision meshes (then the track becomes bigger, the car remains the same).
We are currently working on a very big track where the car position in wold coordinates becomes large (far away from the origin). In that case we see rounding artefacts.
-
nicokruithof
-
- Posts: 14
- Joined: Tue Dec 03, 2013 3:25 am
by Julio Jerez » Tue Dec 03, 2013 2:22 pm
nicokruithof wrote:When the collision tree is build, it creates bounding boxes. To remove the homogeneous coordinate from a 3D vector a bitwise & is done with a bitmask 0xffffffff,0xffffffff,0xffffffff,0x0. For doubles the mask should be twice as long. There are other operations defined on the 3D vector as well.
oh I see, yes you arte right, I need to implemnet the SSE2 version fo the dgBigVector Class
once that class inteface is completer, it should work.
can you tell me the line in teh collsion tree fiel whe teh test fail? I cna us ethat for testin teh bigVector Class.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by nicokruithof » Tue Dec 03, 2013 4:04 pm
With the diff I sent you, the construction doesn't fail anymore. At least, it doesn't give any assertions and my debug visualization looks fine. When I start racing, it doesn't give any collisions. So there is no assertion that fails anymore, but I couldn't see why there were no intersections either.
Let me know if there is anything I can test.
-
nicokruithof
-
- Posts: 14
- Joined: Tue Dec 03, 2013 3:25 am
by Julio Jerez » Tue Dec 03, 2013 4:41 pm
we just have to have thet dgBigVector working correctly.
I will merge your changes on a separate change list and see how i goes.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by nicokruithof » Sat Dec 14, 2013 1:57 am
Any news or something I can test?
-
nicokruithof
-
- Posts: 14
- Joined: Tue Dec 03, 2013 3:25 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 1 guest