Collision "cavities"

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Collision "cavities"

Postby misho » Thu Oct 05, 2017 2:07 pm

I am at the point in my project where I could really use "negative" (boolean) collision objects. I am modelling an interior of objects, and it would be awesome if I could "cut" a cavity inside the object and leave just walls for objects inside to bump against. This would be pretty easy to do if the object was a box (just build the walls), but what if my object was a sphere, that needs to be hollow inside?

Any thoughts on if this could be implemented?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Collision "cavities"

Postby Julio Jerez » Thu Oct 05, 2017 3:07 pm

the only way to do that at the moment is with compound shapes.
That was the purpose of the newton Mesh, which is support to support Boolean, but since for many years no one used it, I never completed the functionality.

There are tools out there that can do Booleans, and then you can used the called the HACD tool to get the convex pices http://khaledmammou.com/ which is very nice.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision "cavities"

Postby misho » Thu Oct 05, 2017 9:01 pm

Julio Jerez wrote:the only way to do that at the moment is with compound shapes.
That was the purpose of the newton Mesh, which is support to support Boolean, but since for many years no one used it, I never completed the functionality.


Ok thanks... yes, compound shapes would work easily if assembling a hollow box... All that was needed was 6 walls for the box. But, this would be difficult to do with a hollow sphere, for example, at least, out of geometric primitives. Perhaps if I used vertex clouds... I would definitely have a use for such functionality. Perhaps if you have spare cycles, you could implement it? :wink:

Julio Jerez wrote:There are tools out there that can do Booleans, and then you can used the called the HACD tool to get the convex pices http://khaledmammou.com/ which is very nice.


Ok - thanks for the link. I don't see completely enclosed cavities in the examples, but I assume they are possible. Is this method compatible with Newton, as in, easily integrated? I would have no clue where to start :shock:

Misho
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Collision "cavities"

Postby Julio Jerez » Thu Oct 05, 2017 10:15 pm

Yes it is compatible with newton.
notice that that tool is no enough, you still nee to get a 3d bolleean library.
the are at many oft them, I just type 3d Boolean in google and click the first link.
http://www.finalmesh.com/boolean3d.htm

so what you do is you take your solid mesh and you running thought the Boolean library,
that will produce the hollow mesh.
the hollow mesh is made of all king of pylyhedrums.
so you take that mesh and convert it to the HACD formal and convert to a collection of convex shapes.
then you take the collection of convex shaped and you build the Newton compound.

another option is that maybe these tools or some form of them are build in blender.
so you might be able to export the set of convex shapes to a file and just read it and make the newton compound.

note: I just saw that the Boolean is commercial, but there are many other who are free and very good, just look for 3d Boolean
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision "cavities"

Postby JoeJ » Fri Oct 06, 2017 11:09 am

https://www.cgal.org/ I have read somewhere that their boolean implementation is robust.
There also falster libs, e.g. https://github.com/gilbo/cork, but because thy use native floating point there may be some issues (even double is not good enough they say).

Did not tried any of those myself :)
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Collision "cavities"

Postby Julio Jerez » Fri Oct 06, 2017 2:42 pm

I have a partial Boolean in the newton mesh, which use extend oppression float.
and adaptive arithmetic, But I never had the time to finished the Boolean for two reason.
1- there was not interest
2-when I start doing the cell destruction I was experimenting with Booleans, by I found that voroinoid cell is far more robust and flexible. so the need for Boolean was no so important

the classe the impemnet the extern prssion math in newton is
..\newton-dynamics\sdk\dgCore\dgGoogol.h

and the classes that implement adaptive arithmetic is
../newton-dynamics\sdk\dgCore\dgSmallDeterminant.h

all important algorithm in newton use these classes to work with exact arithmetic
when I mention exact arrhythmic, this may down misleading but it is not.

eh for example a function that calculate the intersection of tow lines.
the formulation can be expended in in there of matrices.
say the matrix is 3 x 3

if you use a naïve method to calculate a 3 x 3 determinist, you know that you need
a mantissa that is 3 times bigger that the mantissa of a double, do it you have
an 180 bit float them your matrix operations is exact to the machine Presidion of 180 bit.

do no confuse losing press ion because of rational numbers operation with losing Presidion because of mantissa no big enought to hold all the information.

here is an example: say you have a mashine that a one digit word size.
you can hold values for 0 top 9

the operation x = 1 / 3 = 0.333333
can only be save 0.3
because 1 and 3 are rational number, so wne yo uge the inver you can only have 2.9

that is different that doin an operation say 0.8 x 0.8 = 0.64
here you can only retain 0.6 but the 0.04 is not a machine precision error, that's a mantissa truncation lost that can not be recovered.
This sounds trivial and uninteresting but is a huge problem in numerical analysis.
this is why I have those class for numerical sensitive operation.
It requires lots of work to write efficient code using adaptive arithmetic, because of you just adopt a large float your become approximately 2 ^ number of mantissa time slower.
and that's where adaptive precision comes handy.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision "cavities"

Postby Julio Jerez » Fri Oct 06, 2017 2:58 pm

I would take a look blender, I am sure that have that stuff build in already and if they do all he need to do is write an exporter.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 20 guests