We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › subtract or combine two shapes
Page Index Toggle Pages: 1
subtract or combine two shapes (Read 1315 times)
subtract or combine two shapes
Sep 29th, 2009, 2:25am
 
I would like to subtract two shapes into a resulting polygon.
For example i put a sphere into a cube and then i substract them.
This will create a spherical hole into the cube :
-I have to create my two shapes (a sphere and a cube)
-I combine them by giving  same position to us (my sphere into my cube)
-I substract my sphere from my cube <-- how can i do ?
-I render the result : a new polygon made with the previous steps.

i don't know how i can substract them...someone can help me ?
Re: subtract or combine two shapes
Reply #1 - Sep 29th, 2009, 3:04am
 
i gave the tip of using breakShape on this post here:
http://processing.org/discourse/yabb2/num_1251260591.html
that should be helpful

Re: subtract or combine two shapes
Reply #2 - Sep 29th, 2009, 3:55am
 
indeed it can be helpful but for a 2d project  Undecided This synthax seems to not be compatible with 3d render. Maybe i have to
-make two beginShape one for making a cube and another for a sphere
-substract sphere's vertex and cube's vertex

i don t know...
Re: subtract or combine two shapes
Reply #3 - Sep 29th, 2009, 4:16am
 
Well, then it is not really a syntax question, more like a 3D one...
Are we still using the term "shape" for spheres and cubes

Anyway, the question of CSG is both well known... and not trivial.
Even in 2D it isn't so simple except in most trivial cases.
Re: subtract or combine two shapes
Reply #4 - Sep 29th, 2009, 4:42am
 
ah ok, i was confused by "SHAPE" i thought, yeah about a shape not an 3d object. So what you want is some boolean operation to cut an object out of another.  So if you are just trying to create a special kind of object, it would probably be easier to create it using some 3d software and loading it into processing.
Re: subtract or combine two shapes
Reply #5 - Sep 29th, 2009, 6:27am
 
It's exactly what i want to do, i didn't know that we call it CSG. It helps me a lot. Now i ve got the term so i may find information easily. I would like to do it in processing because it allows me to show a process of transformation step by step. I don't want to show only an object but both process and result.

thank you for your quick answer  Smiley


Re: subtract or combine two shapes
Reply #6 - Sep 29th, 2009, 6:45am
 
good luck, if you get some good results. come back and let us know about it.
Page Index Toggle Pages: 1