|
![](/i/fill.gif) |
Wasn't it Warp who wrote:
> I was experimenting with a small macro which creates a mesh shaped like
>a lathe from a spline. (The advantage of meshes over lathes is speed. Another
>one is that with lathes you sometimes get artifacts which you don't get with
>meshes.)
An alternative would be to consider that a spline function can also be
used in an isosurface. I've put a little example of this about halfway
down this page <http://www.econym.demon.co.uk/IsoTut/splines.htm>.
As it happens, this ends up being a ridiculously slow parametric
isosurface, so I use Ingo's macro to convert it to a mesh2 for the
actual rendering, so we end up doing the same thing.
This offers a little bit more flexibility. You can easily arrange for
the cross section to be something other than a circle and the axis to be
something other than a straight line as seen on that page. You can also
add other functions to the isosurface to achieve displacements.
#macro MakeEvenSplinePoints(Points)
#local Amnt = dimension_size(Points, 1)-1;
#local Ind = 0;
#while(Ind <= Amnt)
Ind/Amnt, Points[Ind]
#local Ind = Ind+1;
#end
#end
#declare Points = array[18]
{ <0,.1>,<1,0>,<1.2,.05>,<1,.1>,<.2,.3>,
<.25,.4>,<.1,.9>,<.1,2.5>,<.3,2.8>,<.3,3.1>,
<1,3.25>,<1.25,4>,<1,5>,<.9,5>,<1.1,4.5>,
<1.15,3.8>,<1,3.4>,<0,3.2>
}
#declare Spline = function {spline { cubic_spline
MakeEvenSplinePoints(Points) }}
camera { location -z*14 look_at 0 angle 35 orthographic translate y*2.5
}
light_source { <100,200,-300>, 1 }
light_source { <-100,20,-30>, <1,.5,0>*.5 }
plane { -z,0 pigment { checker rgb 1, rgb .5 } }
#declare Fx = function(x,y) {(Spline(u).x * sin(v))}
#declare Fy = function(x,y) {Spline(u).y}
#declare Fz = function(x,y) {(Spline(u).x * cos(v))}
#declare Umin = 0;
#declare Umax = 1;
#declare Vmin = -pi;
#declare Vmax = 1.001*pi;
#declare Iter_U = 80;
#declare Iter_V = 20;
#include "param.inc"
Parametric()
object {Surface
no_shadow
pigment { rgb 1 } finish { specular .5 }
}
Post a reply to this message
|
![](/i/fill.gif) |