POV-Ray : Newsgroups : povray.newusers : Simple CSG Question : Re: Simple CSG Question Server Time
7 Jul 2024 07:52:17 EDT (-0400)
  Re: Simple CSG Question  
From: Kenneth
Date: 9 Jan 2010 16:45:01
Message: <web.4b48f5b0787758a65f302820@news.povray.org>
"Alan1961" <nomail@nomail> wrote:

> Is it possible to declare an object in such a way that when it is unioned with
> another object(s) it carries a "hole" with it?

Since the hole(s) for your doors--boxes in this case--will always need to be
differenced from the one wall object, that presents a problem. To get the result
you're after, the wall itself would probably need to be part of every 2-door
'difference' grouping--resulting in multiple (though invisible) walls...not to
mention the translations that would be needed, to line up those walls with each
other. Seems kind of cumbersome.

An easier way (one that I would probably use) would be to first #declare your
two doors as a full_door union, then #declare *one* differencing box made from
that (using the min_extent/max_entent trick that you did, if it works OK),
then...

#declare door_position_1 = <1,0,0>;
#declare door_position_2 = <3,0,0>;
#declare door_position_3 = <5,0,0>;
......etc....

// The wall with its doors and holes...
union{ // optional
object{full_door translate door_position_1}
object{full_door translate door_position_2}
object{full_door translate door_position_3}
......etc...
difference{
object{wall}
object{differencing_box translate door_position_1}
object{differencing_box translate door_position_2}
object{differencing_box translate door_position_3}
......etc...
} // end of difference
} // end of union

Adding more doors (and holes) would be very simple.

Ken


Post a reply to this message

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