[vwnc] Jun 3D Open GL Query

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Jun 3D Open GL Query

Tom Carden-4
Hi All,
 
I'm a relative newbie to Jun and would like to have one OpenGL object "subtract" another.
 
for example, take a cube:
JunOpenGL3dObject origin: 0, 0, 0 corner: 10, 10, 10
and subtract another smaller cube:
JunOpenGL3dObject origin: 0, 0, 0 corner: 5, 5, 5
so the result is a cube with one of its corners missing (1/8th).
 
Or another example, take a sphere:
JunOpenGL3dObject sphere: 15 radius: 5
and subtract a cylinder:
JunOpenGL3dObject cylinderBy: 15 radius: 1 height: 6
so the result is a sphere with a hole going all the way through it.
 
Is this possible?
 
Any thoughts/help is much appreciated.
 
Tom.
 
 
 
 
 
 
 
 
 
 
 

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Jun 3D Open GL Query

Tom Carden-4
Apologies all,
 
After much searching I have found the solution to this query.
 
Thank you for anytime spent.
 
Tom
 

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Jun 3D Open GL Query

Henrik Sperre Johansen
Care to share?
Haven't had the use for it myself so far, but it'd be nice to know!
In the short time I spent looking, the closest (pre-built) thing I could find was NonConvexPolygon's ability to define holes, which obviously was a bit more primitive what you were after :/

Cheers,
Henry

On 30.03.2009 20:55, Tom Carden wrote:
Apologies all,
 
After much searching I have found the solution to this query.
 
Thank you for anytime spent.
 
Tom
 

_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Jun 3D Open GL Query

Michael Lucas-Smith-2
I'm not sure what solution was found, but I was intending to reply -
what you want to do is find the latest work on Constructive Solid
Geometry (CSG). This technique lets you subtract one primitive shape
from another primitive shape to create whatever kind of landscape /
models you want.

http://en.wikipedia.org/wiki/Constructive_solid_geometry

Cheers,
Michael

Henrik Sperre Johansen wrote:

> Care to share?
> Haven't had the use for it myself so far, but it'd be nice to know!
> In the short time I spent looking, the closest (pre-built) thing I
> could find was NonConvexPolygon's ability to define holes, which
> obviously was a bit more primitive what you were after :/
>
> Cheers,
> Henry
>
> On 30.03.2009 20:55, Tom Carden wrote:
>> Apologies all,
>>  
>> After much searching I have found the solution to this query.
>>  
>> Thank you for anytime spent.
>>  
>> Tom
>>  
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> vwnc mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Jun 3D Open GL Query

Tom Carden-4
In reply to this post by Tom Carden-4
Henrik/Michael,
 
Thanks for the comments. I too started out with the NonNonConvexPolygon's ability to define holes but soon found this wasn't doing what I wanted. After some searching I've found two ways to attack the problem.
 
1) The classes JunDIFF, JunINTER and JunUNION are able to perform the associated set operations on JunBody's. Check out the example methods for a quick intro. Though I'm having difficulty converting my JunOpenGL3dObjects into JunBodys that can be used for this process. There is a JunBody instantiation method 'JunBody fromJunOpenGL3dObject: aJunOpenGL3dObject ' but if a use a JunBody created this way in the set operations I often run into problems. In my mind the 1st block of code below should work the same as the second block, but I must be missing a subtlety in the conversion from a JunOpenGL3dObject to a JunBody.
 
| body1 body2 temp1 temp2 |
 temp1 := (JunOpenGL3dObject origin: -1 , -1 , -1 corner: 1 , 1 , 1).
 temp2 := (JunOpenGL3dObject origin: 0 , 0 , 0 corner: 1 , 1 , 1).
 body1 := JunBody fromJunOpenGL3dObject: temp1.
 body2 := JunBody fromJunOpenGL3dObject: temp2.
 (JunDIFF body: body1 body: body2) do.
 (body1 asJunOpenGL3dObject) paint: ColorValue blue; show
 
| body1 body2 |
 body1 := JunBody cubeOrigin: -1 , -1 , -1 corner: 1 , 1 , 1.
 body2 := JunBody cubeOrigin: 0 , 0 , 0 corner: 1 , 1 , 1.
 (JunDIFF body: body1 body: body2) do.
 (body1 asJunOpenGL3dObject) paint: ColorValue blue; show
 
Plus I'm finding it difficult to apply multiple operations on a JunBody i.e. trying to subtract more than one cube from a larger cube.
 
2) The class JunCSG has subclasses JunCSGDifference, JunCSGIntersection and JunCSGUnion. Again there are a couple of useful examples in the JunCSG class. I'm going to try implementing this with my code tomorrow and see if I get any further.
 
By the way if anyone knows what DXF format the JunCADModel reads in please let me know. I think it's R12, but it would be nice to have it confirmed. Couldn't see anything in the documentation or on the Jun website.
 
Thanks,
Tom.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc