|
![](/i/fill.gif) |
I found a file called "spline evenly spaced objects.pov" in my povray
directory, I think I picked it up from the newsgroups a while ago, can't
remember who made it though..
This places evenly spaced objects along a spline, but perhaps you can use it
to get an idea on how to achive what you need?
If you know, or are, the person that wrote this, please shout out loud to
give some proper credit here!
-Peter
#include "transforms.inc"
#include "shapes.inc"
#include "strings.inc"
#macro Time_To_Length_Converter(Spline,Min,Max,Accuracy)
#local Conversion=function{spline{
#local Last=Spline(Min);
#local Length=0;
#local C=Min;
#while (C<=Max)
#local C=min(C,Max);
#local Point=Spline(C);
#local Length=Length+vlength(Point-Last);
#local Last=Point;
C , <1,0,0>*Length
#local C=C+Accuracy;
#end
}};
function(T){Conversion(T).x}
#end
#macro Spline_With_Linear_Movement(Spline,Min,Max,Accuracy)
spline{
#local Last=Spline(Min);
#local Length=0;
#local C=Min;
#while (C<=Max)
#local C=min(C,Max);
#local Point=Spline(C);
#local Length=Length+vlength(Point-Last);
#local Last=Point;
Length , Point+<0,0,0>
#local C=C+Accuracy;
#end
}
#end
#declare MySpline = spline {
cubic_spline
-1,<-1,1,0>,
0,<0,1,0>,
0.3, <2,0.7,-2>,
0.6,<3,-0.8,-3>,
0.85,<0,-0.8,-3.5>,
1,<-1,-0.8,-3.72>,
1.1,<-2,-0.8,-3.75>
}
#declare MySplineLinear = Spline_With_Linear_Movement(MySpline,0,1,0.001);
#declare f_MySplineLength = Time_To_Length_Converter(MySpline,0,1,0.001);
#declare MySplineLength = f_MySplineLength(1);
#declare MyObject = cone {0 .2 <0,0,.2> 0.15 pigment{rgb 1}};
#declare Step=MySplineLength/20;
#declare All=union{
#declare Count=0;
#while (Count<=MySplineLength-Step)
object {
MyObject
pigment { rgb <1,.3,.7>}
Spline_Trans(MySplineLinear, Count, y, 0.1, 0.1)
}
#declare Count=Count+Step;
#end
rotate x*90
}
object{Center_Object(All,1)translate z*5}
background{1}
light_source{<0,10,-125> 1}
object {
Center_Object(
union{
#local Q = 0;
#while (Q < 1)
sphere {MySpline(Q),0.1 pigment {rgb <1,1,0>} rotate x*90}
#local Q = Q+0.02;
#end
}
,1)
translate z*5
}
Post a reply to this message
|
![](/i/fill.gif) |