Topology

Good Morning,

can somebody give me an example, how to find out the relation between two shells:
There are two TopoDS_SHell Shell_A and Shell_B.
CASE1:
Shell_A is inside Shell_B
or
Shell_B is inside Shell_A
CASE2:
Shell_A is not situated inside Shell_B
or
Shell_B is not situated inside Shell_A

Under "Shell_A is inside Shell_B" I mean
there is no line in space, that intersects the Shell_A and does not intersect Shell_B.

Are there some fast and simple methods ?
It would be very helpfull for me
thank you in advise

Roman Lygin's picture

Hi Dmitry,

I'd look at using bounding boxes (Bnd_Box, BRepBndLib::Add()) and check if one is inside another. If this is condition is not met then your shells are not inside each other. If yes, then this condition may be even sufficient if your shells are convex.

Hope this helps.

Roman

---
opencascade.blogspot.com - blog on Open CASCADE

Dmitry Khabi's picture

unfortunately its too simple.
There are a lot cases, where the one shape's bndBox is inside the other, but the shapes intersection each other.
For Example: a Sphere (With radius R) and the cube (with side R-epsilon) inside the Sphere.

Dmitry Khabi's picture

sorry I mean the cube is inside the sphere (not in the moddle of the cube) ...
Can you imagine this case ?

Dmitry Khabi's picture

or for example this case:
http://stoma.name/michalis/vrml_engine_doc/output/xsl/html-nochunks/exam...

If you play wirh the Radius of sphere , you will get the different results.

Bob's picture

There is a function in the java demo to get the minimum distance between two faces. If it's non-zero, they don't intersect.

Or try to intersect them. If you get a non-null shape, they intersect.

I don't remember the function names at the moment. You would probably have to break down the shapes, i.e. use a TopExp_Explorer in a for loop, testing each face of one against each face of the other. See http://www.opencascade.org/org/forum/thread_11613/

Dmitry Khabi's picture

"There is a function in the java demo to get the minimum distance between two faces. If it's non-zero, they don't intersect."

It#s a good simple idea, if the shapes intesect each other, they have distance ZERO;) I have to try it. its an intresting to see the code, how it OCC does.

"Or try to intersect them. If you get a non-null shape, they intersect."
I have tried it, it works, but too slowly for me.

Thank you all
In each case,
I will right the results here