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 & HelpOpenGL and 3D Libraries › cut a whole in a 3D box
Page Index Toggle Pages: 1
cut a whole in a 3D box (Read 1299 times)
cut a whole in a 3D box
Mar 17th, 2010, 10:33am
 

Hello,

I have a big box and would like to cut a tunnel in it.  Smiley

Since I want to make it rotate with peasyCam and have other
boxes behind it, I want a real look-through tunnel and not some black box.

So I paint red box A (big one) and then a black box B, thin and but long. I want B to be the tunnel, but noFill or so doesn't work.

Is there a cut-command or a substBox command or something?

Blakout-ish,

Chrisir    Wink


Re: cut a whole in a 3D box
Reply #1 - Mar 17th, 2010, 10:50am
 
You want a hollow shape, but there is no way to do so using box(). You will have to draw the top-right-bottom-left sides of your tunnel yourself or maybe use a shape library that would provide such shapes.

It's not very hard, though :

Quote:
size(200, 200, P3D);
background(255);
translate(width /2, height/2);
for (int i = 0; i < 4; i++) {
  rotateZ(i*PI*0.5);
  pushMatrix();
    translate(0, 24, 0);
    scale(1, 0.1, 1);
    box(50);
  popMatrix();
}
Re: cut a whole in a 3D box
Reply #2 - Mar 17th, 2010, 12:20pm
 
Why am I thinking Virtual Justin Timberlake and Andy Samberg haha.
1: "Cut a hole in a box", 2: "Put your junk in that box", 3: "Make her open the box... and that's the way you do it!"
My **** in a 3D box!  Wink
Just left the wholes out...
Reply #3 - Mar 17th, 2010, 1:45pm
 

Hello!

I did it!

I took your idea and build a Menger's Sponge from it! It's a recursive function; with depth 3 or more it gets real slow...

http://openprocessing.org/visuals/?visualID=8326

For Explanation see:
http://www.angelfire.com/art2/stw/

@jeffg:  Grin

Thanks!

Greetings,

Chrisir    Wink

Page Index Toggle Pages: 1