|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I apologise if this has been covered many times before.
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? There may be a clever way of
doing this that I have missed, it must be a common enough situation for objects
intended for reuse... Doors, Windows etc .
For example declaring an object comprising of a door Frame and a door slightly
ajar which when unioned with a wall it also punches a hole in the wall. I
appreciate I can do something like ...
union
{
#declare Wall = box { <-3*m, 0*m, -5*cm> < 1*m, 3*m, 5*cm> pigment
{brick Grey, Orange scale 2}}
#declare door1 = object{SingleDoor translate -0.5*m*x}
object{door1}
#declare door2 = object{SingleDoor translate -1.5*m*x}
object{door2}
difference
{
object{Wall}
box{ min_extent(door1), max_extent(door1) } //punch a hole!
box{ min_extent(door2), max_extent(door2) } //punch a hole!
}
}
but this feels long winded to me, and I just want to make sure it is the best
approach that everyone uses for this situation.
Ideally I would like to be able to declare SingleDoor such that it also defines
the hole to be punched in the wall allowing the above to be replaced with
something like ...
union
{
box { <-3*m, 0*m, -5*cm> < 1*m, 3*m, 5*cm> pigment {brick Grey,
Orange scale 2}}
object{SingleDoorWithHole translate -0.5*m*x}
object{SingleDoorWithHole translate -1.5*m*x}
}
I appreciate the semantics of my above idealised example could be/is confusing
and ambiguous with other objects in the union and is therefore probably not
possible or implemented, but again I just want to make sure I'm adopting the
best approach and that I've not missed any aspect of POV CSG type functionality
which makes this task easier, clearer or more concise.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alan1961 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?
No, unfortunately not. Also, you should be aware that
min_extent and max_extent do not reliably represent the
minimal bounding box of the object, and that the object
used for cutting a hole should be thicker by at least
a tiny amount than the wall, as coincident surfaces
produce unreliable results as well.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> I apologise if this has been covered many times before.
It's the place to ask those question, even if they have been asked before.
>
> 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? There may be a clever way of
> doing this that I have missed, it must be a common enough situation for objects
> intended for reuse... Doors, Windows etc .
>
> For example declaring an object comprising of a door Frame and a door slightly
> ajar which when unioned with a wall it also punches a hole in the wall. I
> appreciate I can do something like ...
>
It's best to never define any object inside an union, difference or
intersection. It can get REALY confusing.
Declare those components before the start of the union.
> union
> {
> #declare Wall = box {<-3*m, 0*m, -5*cm> < 1*m, 3*m, 5*cm> pigment
> {brick Grey, Orange scale 2}}
> #declare door1 = object{SingleDoor translate -0.5*m*x}
> object{door1}
> #declare door2 = object{SingleDoor translate -1.5*m*x}
> object{door2}
> difference
> {
> object{Wall}
> box{ min_extent(door1), max_extent(door1) } //punch a hole!
> box{ min_extent(door2), max_extent(door2) } //punch a hole!
> }
> }
Use this construction instead:
#declare Wall = box {<-3*m, 0*m, -5*cm> < 1*m, 3*m, 5*cm>}
#declare Door1 = object{SingleDoor translate -0.5*m*x}
#declare Door2 = object{SingleDoor translate -1.5*m*x}
union{
difference{
object{Wall}
box{ min_extent(Door1), max_extent(door1) }
box{ min_extent(Door2), max_extent(door2) }
}
object{Door1}
object{Door2}
pigment{brick Grey, Orange scale 2}
}
It's much cleaner and easier to understand.
This assume that the object SingleDoor does have it's own texture.
You also can use the object SingleDoor directly and translate it as needed.
> but this feels long winded to me, and I just want to make sure it is the best
> approach that everyone uses for this situation.
>
> Ideally I would like to be able to declare SingleDoor such that it also defines
> the hole to be punched in the wall allowing the above to be replaced with
> something like ...
>
> union
> {
> box {<-3*m, 0*m, -5*cm> < 1*m, 3*m, 5*cm> pigment {brick Grey,
> Orange scale 2}}
> object{SingleDoorWithHole translate -0.5*m*x}
> object{SingleDoorWithHole translate -1.5*m*x}
> }
>
> I appreciate the semantics of my above idealised example could be/is confusing
> and ambiguous with other objects in the union and is therefore probably not
> possible or implemented, but again I just want to make sure I'm adopting the
> best approach and that I've not missed any aspect of POV CSG type functionality
> which makes this task easier, clearer or more concise.
>
>
>
>
If you define an object as:
#declare Object_With_Hole=
That object can be used many times and will always have an hole in it.
On the other hand, it's not possible to define any object that will
punsh a hole in another when unioned with it. Only difference and
intersection can remove parts from an object.
Other ways that you can do something similar:
Make your doors, including their texture, with a part of untextured wall
over them. Make an union with those doors and the parts of the wall that
lies between the doors. Apply the wall's texture to the complete union.
The texture will be applied to the wall, and the untextured parts of the
door objects. There will be no discontinuity as you pass from one part
the the next. The textured parts of the doors will keep their original
texture.
Create the wall as a prism object that already include the cutouts for
any door and windows.
Those two methods can be much faster to render if you have several
walls, each with many openings.
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks everyone, Hmmm... I'll have to think on this as I'm not sure what I would
like to acheive is possible, more questions than answers at the moment. Time
to read the help a bit more before I ask any more basic questions.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|