POV-Ray : Newsgroups : povray.beta-test : Filling in T values in splines : Re: Filling in T values in splines Server Time
30 Jul 2024 04:16:59 EDT (-0400)
  Re: Filling in T values in splines  
From: ingo
Date: 24 Feb 2002 07:46:46
Message: <Xns91BF8C7EEDC76seed7@povray.org>
in news:3c78dc4b@news.povray.org Warp wrote:

> or something similar.
> 

Us it as you want it.

---%<------%<---
// The macro allways expects one point
// before t=0 and one after t=1, also for linear splines.
// Use: #declare SPL=BuildSpline(ArrayIdentifiers, "string")
// where string is C|c|L|l|Q|q

#macro BuildSpline(Arr, SplType)
   #local Ds=dimension_size(Arr,1);
   #local Asc=asc(strupr(SplType));
   #if(Asc!=67 & Asc!=76 & Asc!=81) 
      #local Asc=76;
      #debug "\nWrong spline type defined (C/c/L/l/Q/q), using default 
linear_spline\n"
   #end
   spline {
      #switch (Asc)
         #case (67) //C  cubic_spline
            cubic_spline
         #break
         #case (76) //L  linear_spline
            linear_spline
         #break
         #case (81) //Q  Quadratic_spline
            quadratic_spline
         #break
      #end
      #local Add=1/((Ds-2)-1);
      #local J=0-Add;
      #local I=0;
      #while (I<Ds)
         J 
         Arr[I]
         #local I=I+1;
         #local J=J+Add;
      #end
   }      
#end
---%<------%<---


Post a reply to this message

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