POV-Ray : Newsgroups : povray.newusers : Hole in the wall Server Time
5 Nov 2024 07:19:54 EST (-0500)
  Hole in the wall (Message 1 to 8 of 8)  
From: Parasonic
Subject: Hole in the wall
Date: 10 Mar 2002 17:43:02
Message: <3c8be176$1@news.povray.org>
Now that I have made my wall, I need to cut a few shapes into it (i.e.: for
a door). I have tried the difference statement, but the recursiveness of a
while loop is giving me trouble on one hand, errors on the other. Can you
help me to simply make a hole in the wall?

Thanks a lot.


Post a reply to this message

From: Ken
Subject: Re: Hole in the wall
Date: 10 Mar 2002 17:49:13
Message: <3C8BE32B.CAC1BE38@pacbell.net>
Parasonic wrote:
> 
> Now that I have made my wall, I need to cut a few shapes into it (i.e.: for
> a door). I have tried the difference statement, but the recursiveness of a
> while loop is giving me trouble on one hand, errors on the other. Can you
> help me to simply make a hole in the wall?

Wrap your while loop in a union and difference from that.

Using Peter's example

#declare Box = box { -1, 1 }

#declare Wall =
union{
#declare i=0;
#while (i<5)
  object { Box translate 2.1*i*x }
  #declare i=i+1;
#end
}

difference {
 object {Wall}
  box{-1,1}
}

-- 
Ken Tyler


Post a reply to this message

From: Peter Popov
Subject: Re: Hole in the wall
Date: 11 Mar 2002 02:05:50
Message: <n8lo8u0nlh6h0fc8vnj61h6eh3bgfm1ekt@4ax.com>
On Sun, 10 Mar 2002 14:50:19 -0800, Ken <tyl### [at] pacbellnet> wrote:

>> Now that I have made my wall, I need to cut a few shapes into it (i.e.: for
>> a door). I have tried the difference statement, but the recursiveness of a
>> while loop is giving me trouble on one hand, errors on the other. Can you
>> help me to simply make a hole in the wall?
>
>Wrap your while loop in a union and difference from that.

Ouch! That's slow :(

Better not generate the boxes which you don't need that cut them out
completely. Inside the #while loop, only generate the box #if it fits
some criteria. For example,

...
#if ( !((Row>=0) & (Row<=8) & (Column >=6) & (Column <= 10)) )
  box {... whatever...
#end

If your wall has "staggered" stones (as it should), then you should
have a separate check for the left and right end of the door and use a
difference as Ken pointed out (but not the whole union, just the
bricks that you need!)

Hope this helps. I won't spoil more of your fun, learning POV does
include some banging your head against a wall <g>


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Christopher James Huff
Subject: Re: Hole in the wall
Date: 11 Mar 2002 10:35:43
Message: <chrishuff-493389.10353911032002@netplex.aussie.org>
In article <n8lo8u0nlh6h0fc8vnj61h6eh3bgfm1ekt@4ax.com>,
 Peter Popov <pet### [at] vipbg> wrote:

> Better not generate the boxes which you don't need that cut them out
> completely. Inside the #while loop, only generate the box #if it fits
> some criteria. For example,

Even better:
If any part of the box will be cut, don't generate that box. Then, go 
through again, and make a union of the boxes that will be cut (minus the 
ones that will be removed completely)...difference from that.

Alternatively, loop through once, if the block is partially cut use a 
difference *for that block*. This uses many differences of single 
objects instead of one difference of many objects, only requires one 
loop and simpler code, and is probably faster.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Peter Popov
Subject: Re: Hole in the wall
Date: 11 Mar 2002 16:05:59
Message: <a2vp8ukt97hjbfnf0qkatteubd2qn26llh@4ax.com>
On Mon, 11 Mar 2002 10:35:39 -0600, Christopher James Huff
<chr### [at] maccom> wrote:

>Alternatively, loop through once, if the block is partially cut use a 
>difference *for that block*.

But that's what I meant!

Even better. If the door is a box, don't intersect at all, just
generate the necessary boxes as wide as necessary :)


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Jan Walzer
Subject: Re: Hole in the wall
Date: 11 Mar 2002 17:34:17
Message: <3c8d30e9@news.povray.org>
no one yet suggested to create it as a mesh ?


Post a reply to this message

From: Christopher James Huff
Subject: Re: Hole in the wall
Date: 11 Mar 2002 18:09:23
Message: <chrishuff-26C64D.18085311032002@netplex.aussie.org>
In article <3c8d30e9@news.povray.org>, "Jan Walzer" <jan### [at] lzernet> 
wrote:

> no one yet suggested to create it as a mesh ?

Not very much reason for it...a mesh would be helpful in reducing the 
memory requirements of large areas of plain wall (if you don't mind the 
repeating), but probably wouldn't be worth the trouble for small 
segments with windows and doors cut out.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Hole in the wall
Date: 11 Mar 2002 18:21:05
Message: <chrishuff-E10340.18203311032002@netplex.aussie.org>
In article <a2vp8ukt97hjbfnf0qkatteubd2qn26llh@4ax.com>,
 Peter Popov <pet### [at] vipbg> wrote:

> >Alternatively, loop through once, if the block is partially cut use a 
> >difference *for that block*.
> 
> But that's what I meant!

Sorry, I thought you were talking about not generating blocks that would 
be completely removed anyway.


> Even better. If the door is a box, don't intersect at all, just
> generate the necessary boxes as wide as necessary :)

Could take quite a few boxes and be tedious to code if you want to cover 
all cases, and probably wouldn't be much faster (a cutout from the very 
center of the block would require 6 boxes, an equivalent difference 
would only need 2). However, if you only consider the most likely cases 
(cutting off one end or cutting off one edge), you could keep it down to 
1 or 2 boxes.

Actually, I think I'm making it too hard, trying to imitate the effect 
of CSG...bricks usually aren't cut that way, they are just chopped off. 
Just use one block that is shortened to fit, maybe with some randomness 
to make the edge slightly uneven.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.