Mike Williams wrote:
> Is there a utility that will take a spline and reorganize the control
> points to be evenly spread without changing the shape?
>
I usually use this:
#macro SmoothSpline( Spline, Grain )
//get total length of spline
#local TL=0;
#local Ptr=1;#while(Ptr<=Grain)
#local TL=
TL+vlength( Spline(Ptr/Grain)
-Spline((Ptr-1)/Grain) );
#local Ptr=Ptr+1;#end
#local L=0;
//redefine spline
spline {
natural_spline
0 Spline(0)
#local Ptr=1;#while(Ptr<=Grain)
#local L=
L+vlength( Spline(Ptr/Grain)
-Spline((Ptr-1)/Grain) );
L/TL Spline(Ptr/Grain)
#local Ptr=Ptr+1;#end
}
#end
Seems obvious. Limited testing shows that the resulting
spline is close to the original. Equal clock increments seem to
generate equal spacing to some degree of precision. What am I missing?
Post a reply to this message
|