|
![](/i/fill.gif) |
"Mutley2003" <nomail@nomail> wrote in message
news:web.418c3672dcf0fdac265d26690@news.povray.org...
> At least I think it is CSG that I need. I am still learning Povray, or
> should I say I have just started to learn ... an hour or so here and
there.
>
> OK, I can make a nice piece of virtual wood with a somewhat realistic
> pattern on it and some "moulding" effects , using a prism.
>
> What I want to do is "cut" this piece into 4, then take a 45 degree
"slice"
> off each corner, then "glue" the bits together, just like you would do if
> you were making a picture frame in the physical world.
>
> The reason I want to use a single piece and the cut/slice/glue process
> (rather than building 4 separate pieces) is I want it to look like it all
> came from the one piece.
>
> Can someone give me some help on the CSG for cutting and slicing?
>
> thank you
>
>
>
Hi,
I think the following is roughly what you are asking for.
Declare your object as one long piece running along the z axis (with the
appropriate texture) and facing upwards. Then use it to cut four pieces
from, translating and rotating each piece so they fit together (in the
example below into a square).
The 'difference' uses CSG, taking the first object and cutting away all
following objects. I think for this the plane is probably as good as
anything to do the cutting.
I've shown two variants for defining the plane, the first defines a plane
perpendicular to the +z axis and rotates it, the second method defines a
plane at 45 degrees, (so no need to rotate it).
The length of a side is dictated by the difference between the distance you
translate the first plane along the z axis and the distance you translate
the second plane along the z axis.
The first translation at the end of the difference statement moves the cut
piece back along the z axis so it is centred at the origin, then it is
rotated to the appropriate orientation and translated a second time into
position.
Hope this helps:
camera {location <0,5,-5> look_at <0,0,0>}
light_source { <0, 20, 8> color rgb <1, 1, 1> }
#declare myObject = cylinder {<0,0,-1><0,0,20>,0.1 pigment {color rgb
<1,0.5,0>}}
difference {
object{myObject}
plane {z,0 rotate y*45 }
plane {z,0 rotate y*135 translate z}
translate -z/2 rotate -y*90 translate z/2
}
difference {
object{myObject}
plane {<1,0, 1>,0 translate z }
plane {<1,0,-1>,0 translate z*2}
translate -3*z/2 rotate -y*180 translate -x/2
}
difference {
object{myObject}
plane {<1,0, 1>,0 translate z*2}
plane {<1,0,-1>,0 translate z*3}
translate -5*z/2 rotate -y*270 translate -z/2
}
difference {
object{myObject}
plane {<1,0, 1>,0 translate z*3}
plane {<1,0,-1>,0 translate z*4}
translate -7*z/2 translate x/2
}
Post a reply to this message
|
![](/i/fill.gif) |