Skip to main content

Calculate intersection of two colliding objects

3 replies [Last post]
Anonymous

Hello list.

My question is simple to ask but probably difficult to solve. Is it
possible to obtain the geometry of the intersection of two objects in
Java3D?

My objects are a set of (normally) closed surfaces but I would be also
interested in solid objects.

Well, that takes me to a second question. How are solid objects
supported/implemented in Java3D?

Best,
jaume.

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mickaël BRASEBIN

Hello,

To calculate the intersection of 2 objects I use JGeom Library (LGPL
licence) https://jgeom.dev.java.net/. It is quite easy to use because a
converter between Java3D and the format of the library is included.

An other library exist named unbboolean available here:
http://unbboolean.sourceforge.net/ but I never tested it.

Nevertheless, I believe that for dynamic collision calculation they must be
too slow...

About solid, I think there are only Sphere and Cube classes. I believe that
it is not important to know for rendering if an object is a Solid.

Have a nice day.

-----Message d'origine-----
De : jaume dominguez faus [mailto:jaume@land.aau.dk]
Envoyé : mercredi 13 octobre 2010 14:34
À : interest@java3d.dev.java.net
Objet : Calculate intersection of two colliding objects

Hello list.

My question is simple to ask but probably difficult to solve. Is it
possible to obtain the geometry of the intersection of two objects in
Java3D?

My objects are a set of (normally) closed surfaces but I would be also
interested in solid objects.

Well, that takes me to a second question. How are solid objects
supported/implemented in Java3D?

Best,
jaume.

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

jaume dominguez faus

Hi Mickaël!

Well, this library looks pretty promising :-). But I can't find any
source code neither for the the library itself or for the examples. Do
you know where I can find the basic helloworlds? maybe you can provide
me with them?

best

On 10/13/2010 02:55 PM, Mickaël BRASEBIN wrote:
> Hello,
>
> To calculate the intersection of 2 objects I use JGeom Library (LGPL
> licence) https://jgeom.dev.java.net/. It is quite easy to use because a
> converter between Java3D and the format of the library is included.
>
> An other library exist named unbboolean available here:
> http://unbboolean.sourceforge.net/ but I never tested it.
>
> Nevertheless, I believe that for dynamic collision calculation they must be
> too slow...
>
>
> About solid, I think there are only Sphere and Cube classes. I believe that
> it is not important to know for rendering if an object is a Solid.
>
>
> Have a nice day.
>
>
> -----Message d'origine-----
> De : jaume dominguez faus [mailto:jaume@land.aau.dk]
> Envoyé : mercredi 13 octobre 2010 14:34
> À : interest@java3d.dev.java.net
> Objet : Calculate intersection of two colliding objects
>
> Hello list.
>
> My question is simple to ask but probably difficult to solve. Is it
> possible to obtain the geometry of the intersection of two objects in
> Java3D?
>
> My objects are a set of (normally) closed surfaces but I would be also
> interested in solid objects.
>
>
> Well, that takes me to a second question. How are solid objects
> supported/implemented in Java3D?
>
> Best,
> jaume.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Mickaël BRASEBIN

Hello,

There is an executable class in one of the .jar provided in the internet
website :
https://jgeom.dev.java.net/servlets/ProjectDocumentList?folderID=3175&ex...
Folder=3175&folderID=0

The class is net.jgeom.examples.j3d.boolop.TestStartup. You can consult the
code source thanks to the CVS on the project website.

I use this code for my operations (union, difference and intersection). I
hope it won't be too difficult to read.

[CODE]

//jgeom import
import net.jgeom.ext.mesh.boolop.AnySurfaceBoolOpd;
import net.jgeom.ext.mesh.boolop.BoolopTriangled;
import net.jgeom.ext.mesh.boolop.GeometryConverterd;
import net.jgeom.ext.mesh.boolop.J3DBoolOp;

...

//Shape3D sh and sh2 are 2 Shape3D construct"ed
TriangleArray and empty apperance

Geometry tmp = sh.getGeometry();
//Capabilities and geomtry prepartion
tmp = GeometryConverterd.transformAndAddColor((TriangleArray) tmp,
new Transform3D(), new Color3f(1.0f, 0, 0));
tmp.setCapability(GeometryArray.ALLOW_COORDINATE_READ);
tmp.setCapability(GeometryArray.ALLOW_NORMAL_READ);
tmp.setCapability(GeometryArray.ALLOW_COUNT_READ);

tmp.setCapability(Geometry.ALLOW_INTERSECT);

tmp.setCapability(GeometryArray.ALLOW_COLOR_READ);

Geometry tmp2 = sh2.getGeometry();

//Capabilities and geomtry prepartion
tmp2 = GeometryConverterd.transformAndAddColor((TriangleArray) tmp2,
new Transform3D(), new Color3f(1.0f, 0, 0));
tmp2.setCapability(GeometryArray.ALLOW_COORDINATE_READ);
tmp2.setCapability(GeometryArray.ALLOW_NORMAL_READ);
tmp2.setCapability(GeometryArray.ALLOW_COUNT_READ);

tmp2.setCapability(Geometry.ALLOW_INTERSECT);

tmp2.setCapability(GeometryArray.ALLOW_COLOR_READ);

//Object to process calculation
AnySurfaceBoolOpd boolop = new AnySurfaceBoolOpd();

// Calculation of the operation
//Type is one of J3DBoolOp.INTERSECTION,
J3DBoolOp.UNION or J3DBoolOp.DIFFERENCE
//According to the operation
boolop.combineSurface((TriangleArray) tmp, (TriangleArray) tmp2,
type,
null);

// The result, a list of triangles
List t = boolop.getResultingTriangles();

[/CODE]

Good luck :)

-----Message d'origine-----
De : jaume dominguez faus [mailto:jaume@land.aau.dk]
Envoyé : mercredi 13 octobre 2010 16:17
À : interest@java3d.dev.java.net
Objet : Re: Calculate intersection of two colliding objects

Hi Mickaël!

Well, this library looks pretty promising :-). But I can't find any
source code neither for the the library itself or for the examples. Do
you know where I can find the basic helloworlds? maybe you can provide
me with them?

best

On 10/13/2010 02:55 PM, Mickaël BRASEBIN wrote:
> Hello,
>
> To calculate the intersection of 2 objects I use JGeom Library (LGPL
> licence) https://jgeom.dev.java.net/. It is quite easy to use because a
> converter between Java3D and the format of the library is included.
>
> An other library exist named unbboolean available here:
> http://unbboolean.sourceforge.net/ but I never tested it.
>
> Nevertheless, I believe that for dynamic collision calculation they must
be
> too slow...
>
>
> About solid, I think there are only Sphere and Cube classes. I believe
that
> it is not important to know for rendering if an object is a Solid.
>
>
> Have a nice day.
>
>
> -----Message d'origine-----
> De : jaume dominguez faus [mailto:jaume@land.aau.dk]
> Envoyé : mercredi 13 octobre 2010 14:34
> À : interest@java3d.dev.java.net
> Objet : Calculate intersection of two colliding objects
>
> Hello list.
>
> My question is simple to ask but probably difficult to solve. Is it
> possible to obtain the geometry of the intersection of two objects in
> Java3D?
>
> My objects are a set of (normally) closed surfaces but I would be also
> interested in solid objects.
>
>
> Well, that takes me to a second question. How are solid objects
> supported/implemented in Java3D?
>
> Best,
> jaume.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net