algorithms of holes or/and overlaps detection

hi i'm loocking for a library to use for 3D visualisation and i would like to know if there are algorithms of holes or/and overlaps detection already coded in opencascade.

thanks for help!

Rob Bachrach's picture

Opencascade has the BRepAlgoAPI package containing functions for fuse (add), cut (substract), common (intersect), and section (slice).

korchi's picture

hi rob
thanks for your help,
in my project i should display 3D volumes and i should detect holes between them and hightlight them. so is there in the BRepAlgoAPI package algos that detect these holes between these volumes or i should use the functions you mentioned (fuse (add), cut (substract), common (intersect), and section (slice))to make the algo myself.

thanks.

Rob Bachrach's picture

I'm sorry, I misunderstood your original question. These algorithms do not detect holes, they create them. There are no algorithms to automatically detect holes. You might consider looping through the faces of your volumes (using TopExp_Explorer) and then looking for faces containing multiple wires. Edges in the outer wire can be eliminated with BRepTools::OuterWire. Then you can use the remaining edges to find the connected faces of your holes.

korchi's picture

hi rob,
thanks a lot for the idea that i may use for the algorithme to detect the holes. i have some more questions:
--during the visualisation if i use you 're idea when i will eliminate the edges in the outer wire isn't it going to desapear from the viewer
--the work i m supposed to do must be interfacable with swing (does it mean that i should use jni).
thanks for your time.

Rob Bachrach's picture

When I write of "eliminating" the outer wire, I mean eliminating it from your options, not removing it from your geometry. You know the outer wire is not part of the hole, so you can ignore it (or eliminate it from) your algorithm that is trying to find the edges of the hole.

Sorry, I'm a C++ guy, so I can't help you with the Java stuff.

korchi's picture

hi,

would you please tell me where i can find breptools in the documentation !!

thanks for the help.

Rob Bachrach's picture

If using the reference documentation, select "ModelingData". Then, select "Class Hierarchy" from the top menu and scroll down to "BRepTools". I mostly only use the CDL files for detailed, readable documentation. Check out this thread for information on getting a nice version:

http://www.opencascade.org/org/forum/thread_10470/

korchi's picture

hi rob,
thanks for the documentation it s much more clear now!!
i tryed to compile the java exemples given in the installation zip
but he doesn t find a package called jcas is it because it has been removed from the occ version 6.2 ? and that the exemples haven t been corrected or adapted to work in this version of occ?

Jan Brüninghaus's picture

No, jcas is still part of OCC. You find the source code in src/jcas and the library beneath the other OCC-libraries.

korchi's picture

hi jan,
thanks for replying.
i did found the jcae directory, well then why in the compilation of the java exemples it says that jcas.Object doesn t exist.
should i compile this directory before compiling the exemples?
thanks for your help!

korchi's picture

hi jan,
thanks for replying.
i did found the jcae directory, well then why in the compilation of the java exemples it says that jcas.Object doesn t exist.
should i compile this directory before compiling the exemples?
thanks for your help!

Jan Brüninghaus's picture

How do you compile the examples and what is the exact error message?

korchi's picture

hi
i made for a second time a make ; make install in the directory ros
and then i made a ./rebuild in the samples directory
now i don't have the mistake about jcas package missing but
when i use my own jdk 1.5 i have 8 errors and i know why it s because the package DrawingSurface has been removed from the package sun.aw.
since the jdk 1.4
so i tryed to use the jvm of opencascade to make the exemples work and i have a probleme on giving him the good path $JAVAHOME because when i looked in the 3rdparty directory i've found javac and jar only in a directory called green_threads and when i give him that path
he tells me this
[elouarti@rhel4 java]$ ./build.csh
JAVAHOME not setted . Please define it : /mnt/coflight_dev/elouarti/opencascade/3rdparty/Linux/java
/mnt/coflight_dev/elouarti/opencascade/3rdparty/Linux/java/bin/javac: Command not found.
/mnt/coflight_dev/elouarti/opencascade/3rdparty/Linux/java/bin/jar: Command not found.
[elouarti@rhel4 java]$ ./build.csh
JAVAHOME not setted . Please define it : /mnt/coflight_dev/elouarti/opencascade/3rdparty/Linux/jvm/bin/i386/green_threads
/mnt/coflight_dev/elouarti/opencascade/3rdparty/Linux/jvm/bin/i386/green_threads/javac: error while loading shared libraries: libhpi.so: cannot open shared object file: No such file or directory

please help!!!

Jan Brüninghaus's picture

Have you already read the following thread?
http://www.opencascade.org/org/forum/thread_10022/

There is no need to stick with the JVM in 3rdparty

korchi's picture

hi,
thanks for your help, now i have compiled the java exemples and it works!!!
i have found on internet a site talking about occjava which is a java buinding for opencascade. and since i'm supposed to use java in my project do you think i should use it or not?
i'm just looking for advice
thanks anyway

Jan Brüninghaus's picture

Sorry, I have no experience with jcae (which is the thing you found, i think).

korchi's picture

hi,

i heard that wok in occ helps to use java with opencascade .
would you explain to me how does it work please.

and thanks a lot for your help.

Jan Brüninghaus's picture

We map only a very few functions directly. Mostly we use own C++-functions that do a lot of things with OCC and map them. Because of this, we write the needed JNI-functions by hand.

So i never used wok to generate JNI-functions.

korchi's picture

hi,

thanks a lot for your help

i have another question: it is important in the project that the used software must be interfacable with swing so i would like to know if it's possible and easy to do with opencascade.

Jan Brüninghaus's picture

Have a look at the java examples provided with OCC. There is swing used. ;-)

The OCC-Window is an awt.Canvas that is in a JPanel. For the native painting of OCC in the Canvas the The AWT Native Interface [1] is used.

[1] http://java.sun.com/j2se/1.5.0/docs/guide/awt/1.3/AWT_Native_Interface.html

korchi's picture

hi,
thanks a lot for your help
i didn't look at the code of the java exemples because they are asking me to verify if opencascade verifie certain criteria.
since the data i should visualize is under an xml format(that might be transformed to java classes using a software) so i would like to know if it's going to be hard to adapt it to the data treated by occ's vizualisation toolkit.
i would like to know if jni must be written bu hand to use occ with java.

sorry for asking so much questions but i have to make my choice next week (it's for my trainig subject in thales).

Jan Brüninghaus's picture

It depends. ;-)

You can get a OCC-application with viewer and buttons etc. simply by taking e.g. the import/export Java-sample. A package CASCADESamplesJni is provided with the samples, wich wraps some OCC-classes to Java via JNI.

The question is, what the data, you have to visualize, can look like? I think you will have to build the structure from scratch with the necessary OCC-functions. The functions you need to create a BRep-structure are not part of the classes provided with the samples (if i remember correctly). So you would have to wrap those you need.

But apart from this, if you only need to visualize the data, why importing the xml-file in Java? You could make an C++-function, that handles all the importing and returns you an TopoDS_Shape via JNI to Java. That would be much easier (and faster).

korchi's picture

> if you only need to visualize the data, why importing the xml-file in Java? You could make an C++-function, that handles all the importing and returns you an TopoDS_Shape via JNI to Java. That would be much easier (and faster).
i will need to visualize the data and also to make algorithms to detect holes and overlaps between the displayed volumes and highlight them

one of the important criteria i should check is the rapidity and the number of volumes that occ can display at the same time so that i verify if it can be integrated in the project i'm working in.
so do you have any idea about (even approximatively) on the scale of data that could be treated at the same time by occ -- the volumes to be displayed are elementary space volumes: some vertex points and two planes Which aren't necessarily horizontal --

i hope i'm not Disturbing you with my questions.

thanks for your help anyway.