|
![](/i/fill.gif) |
/*In exploring Lightwave's modeling tools, I came across the fact that
lathes in LW are created using a pre-determined number of flat segments
that are later smoothed. This got me to thinking that maybe this idea would
apply itself to POV-Ray, so I began working on this simple Lathe Segments
macro. It only does linear splines right now, but it is useful for making
picture frames, crystals, moldings, and any other application where a
partial lathe might be of use. */
#include "colors.inc"
#include "textures.inc"
background {Gray70}
camera {
location <0,0,-20>
look_at <0,0,0>}
light_source {
<10,10,-40>
White}
light_source {
<-20,5,-10>
White*.75}
#declare Frame_Spline =
spline {
1,<5,0>
2,<5,.5>
3,<5.5,.75>
4,<5.5,1>
5,<6,1.25>
6,<6.25,1.5>
7,<7.25,1.75>
8,<7.5,1>
9,<7.25,0>}
#declare Base_Lathe =
spline {
1,<0,0>
2,<0,0>
3,<1,1>
4,<1,2>
5,<1.5,4>
6,<.5,6>
7,<.5,8>
8,<0,10>
9,<0,10>}
#macro LatheSeg(LatheName,Points,Smooth,XZExt,YExt,Seg,Vis,Color)
union {
#if(Smooth=1)
#declare Lathe_Slice =
lathe {
Points,
#declare Count = 0;
#while(Count<Points)
LatheName(Count)
#declare Count = Count +1;
#end}
#else
#declare Lathe_Slice =
prism {
-XZExt,XZExt,Points
#declare Count = 0;
#while(Count<Points)
LatheName(Count)
#declare Count = Count +1;
#end
rotate x*-90
rotate y*-90}
#end
#declare Lathe_Seg = difference {
object {Lathe_Slice}
box {<-XZExt,-YExt,-XZExt>,<0,YExt,XZExt> rotate y*-180/Seg}
box {<0,-YExt,-XZExt>,<XZExt,YExt,XZExt> rotate y*180/Seg}}
#declare Count = 0;
#while (Count <Vis)
object {Lathe_Seg rotate y*Count*(360/Seg)}
#declare Count = Count +1;
#end
pigment {Color}
finish {specular 1}}
#end
object {LatheSeg(Frame_Spline,9,0,7.25,7.25,4,4,Red)rotate x*-90 }
object {LatheSeg(Base_Lathe,9,0,8,10,6,6, Green) translate <-3,-4.8,0> }
object {LatheSeg(Base_Lathe,9,1,8,10,4,3, Blue) rotate y*-45 translate
<3,-4.8,0>}
#declare Ship_Top = object {LatheSeg(Base_Lathe,9,1,8,10,4,2, Silver)}
union {
object {Ship_Top scale <1,1,.5>}
object {Ship_Top scale <2,.9,.125>}
object {Ship_Top scale <1,1,-1> scale <1,1,.25>}
translate y*-5
rotate x*-120
rotate y*45
rotate z*-20
translate z*-3}
//Dave Dunn - hos### [at] aol com
#local D = union { torus {1,.1 clipped_by {plane {-x,0}}} sphere
{<0,0,1>,.1} sphere {<0,0,-1>,.1} cylinder {<0,0,-1>,<0,0,1>,.1} pigment
{rgb .8} finish {ambient .5 reflection {.5}} rotate x*-90 translate
<-.5,.5,5>} object {D} object {D translate <.5,-1,0>} plane {y,-2 pigment
{checker rgb 1, rgb 0 scale 5} finish {ambient .5}}
Post a reply to this message
|
![](/i/fill.gif) |