|
|
Walters wrote:
>
> I'm just a beginner in Moray so once in
> a while I'll ask some questions here.
> Here's my my question:
> Let's assume there are 3 spheres; A, B
> and C. They are placed in a line but
> they overlap a little. Now B should be
> the difference from A but B also has to
> make a intersection with C. Is there a
> simple way to let B be a part of two
> CSG's or should I make 2 B's at the same
> position?
>
> Johan Walters
You are correct in the way you are solving the problem. There is one trap
that Pov will let you fall into. If you look at the two Pov script examples
below you will see in the first basicaly what you propose with two copies
of B doing it's job on two different objects in two seperate operations.
This is what you are proposing with two operations and two B's:
#declare A = sphere {x*-0.5, 1 }
#declare B = sphere {x* 0.0, 1 }
#declare C = sphere {x* 0.5, 1 }
difference {
object { A }
object { B }
}
intersection {
object { C }
object { B }
}
OR...
This is still two operations but uses only one copy of B to do so.
#declare A = sphere {x*-0.5, 1 }
#declare B = sphere {x* 0.0, 1 }
#declare C = sphere {x* 0.5, 1 }
intersection {
difference {
object { A }
object { B }
} // end difference
object { C }
} // end intersection
This last example on the surface looks like it will work but
there is a problem with it. By wrapping A and B in one CSG operation,
then placing them inside a nested CSG operation, C actualy becomes
the active intersecting object as opposed to being intersected by B.
This is one of the important issues with CSG operations and that
is the order in which the program will procees an object. The first
object in a CSG is the object being acted upon while the second is
the one taking the active role.
If we take a closer look it now becomes obvious that C is trying
to intersect both A and B and that is not what we want to happen.
This leaves us with your original suggestion as the correct way to
proceed.
--
Ken Tyler
mailto://tylereng@pacbell.net
Post a reply to this message
|
|