|
|
ABX and Ingo, thanks for your replies - I'm afraid they don't work though.
ABX, the message you took as basis for your reply was not correct. The cubic
spline used in spline{} is different from the cubic spline used in prisms.
Each segment in the spline is defined by all control points in the spline,
not just four. See the other messages in the thread "Cubic spline question"
for more information.
Ingo, you suggested adding an additional point in order to get a smooth
connection (one more point than in the method ABX talked about). However, a
test reveals that this doesn't work either.
In the code below is a spline that's supposed to be closed. I have also made
a blue graph that shows the curvature over the spline. The middle of the
graph is where the connection is. If you render the code with no
modifications you should see in the graph a blue dot high above the others
right where the connection is. This indicates a break in the curvature,
which means that the graph is not smooth. You can even see this with the
naked eye.
You can you add one more control point as Ingo suggested by uncommenting one
control point in the graph. Now the spline looks much more smooth to the
naked eye, but the blue graph shows that there's still a break in the
curvature. Even if you add yet another control point the break is still
there. So I think that it's practically impossible to get perfectly smoothly
connected curves with the cubic splines used in the spline{} feature, which
Mark Wagner says is the "natural cubic spline".
camera {location 4*y look_at 0 translate z}
light_source {1000*y, color 1}
plane {y, 0 pigment {checker color rgb 1.0, color rgb 0.9}}
#declare Spline =
spline {
cubic_spline
// -2, <-2,0,2>, // P1 (uncomment to add a control point)
-1, <-1,0,0>, // P2
0, < 0,0,0>, // P3 red joining point
1, < 1,0,0>, // P4
2, < 2,0,2>, // P5
8, <-2,0,2>, // P1
9, <-1,0,0>, // P2
10, < 0,0,0>, // P3 red joining point
11, < 1,0,0>, // P4
// 12, < 2,0,2>, // P5 (uncomment to add one more control point)
}
#declare C = 0;
#while (C<=200)
#declare V = C/20;
sphere {Spline(V), 0.02 pigment {color <1,0,0>}}
#declare C = C+1;
#end
#declare C = 0;
#declare Cm = 400;
#while (C<=Cm)
#declare V = C/Cm;
#declare T0 = mod((C-1)/40+5,10);
#declare T1 = mod( C /40+5,10);
#declare T2 = mod((C+1)/40+5,10);
sphere {
<
-2+4*C/Cm
0,
1+100*vlength(
+(Spline(T1)-Spline(T0))
-(Spline(T2)-Spline(T1))
)
>
0.02
pigment {color <0,0,1>}}
#declare C = C+1;
#end
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|