POV-Ray : Newsgroups : povray.general : rolled up maps : Re: rolled up maps Server Time
1 Aug 2024 14:28:02 EDT (-0400)
  Re: rolled up maps  
From: Jim Charter
Date: 17 Jan 2006 04:22:11
Message: <43ccb743$1@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.