|
|
Rainer Mager wrote:
>
> Hi all,
>
> Can anyone tell me if this is a bug or correct behavior? I've trying to
> make a CSG shape and I have a clipped_by statement withing a union (so it
> should only affect that union, right). I also have that union differenced
> from another union.
> What I am seeing, however, is that the clipped by is affecting the
> entire shape, not just the local union. Any ideas? Oh, this is on POVRay
> 3.1e.
> What I'm trying to accomplish is that I don't want the hole going all
> the way through the screw. It should stop 0.1 above the bottom.
>
> Here's a code snippet:
>
> #declare Screw = difference {
> union {
> cylinder {
> <0, 0, 0>, <0, 0.1, 0>, 0.5
> }
> sphere {
> <0, 0, 0>, 0.5
> scale <1, 0.5, 1>
> translate <0, 0.1, 0>
> }
> }
> union {
> box {
> <-0.1, -0.5, -0.5>, <0.1, 0.5, 0.5>
> rotate x*45
> translate <0, 0.5, 0>
> }
> box {
> <-0.1, -0.5, -0.5>, <0.1, 0.5, 0.5>
> rotate x*45
> rotate y*90
> translate <0, 0.5, 0>
> }
> clipped_by {
> plane {
> y, 0.1
> }
> }
> }
> }
>
> Thanks,
>
> --Rainer
Try these modifications. I too am unsure wht it won't work but it
may be the depth of the cutting boxes. Adding a scale to the first
union helped remove the hole.
You had another problem you had not seen yet while working out the
other one. The second union of the two boxes left the interior walls
intact when trimming the top with the clipped by. Using a merge
instead took care of the interior walls problem and left me open to
use an intersection in a second declared operation. You could as
easily add the intersection out side the difference operation and
recieve the same results. I left them seperated for illustration
sake and to help me keep the operations seperated for problem solving
sake.
Anyway the code below does produce a nice Phillips head screw driver
slot and I am content with it from a visualy accurate point of view.
#declare ScrewHead = difference {
union {
cylinder {
<0,0, 0>, <0, 0.1, 0>, 0.5
}
sphere {
<0, 0, 0>, 0.5
scale <1, 0.5, 1>
translate <0, 0.1, 0>
}
}
merge { // union {
box {
<-0.1, -0.5, -0.5>, <0.1, 0.5, 0.5>
rotate x*45
translate <0, 0.5, 0>
}
box {
<-0.1, -0.5, -0.6>, <0.1, 0.5, 0.5>
rotate x*45
rotate y*90
translate <0, 0.5, 0>
}
scale<1,.7,1>
}
// clipped_by {
// plane {
// y, 0.1
// }
// }
}
#declare Screw = intersection {
object {
ScrewHead
}
plane {
y, .1
}
pigment {
rgb 1
}
}
object { Screw }
--
Ken Tyler
mailto://tylereng@pacbell.net
Post a reply to this message
|
|