POV-Ray : Newsgroups : povray.general : T-less spline macro for P3.5 Server Time
18 Nov 2024 13:14:49 EST (-0500)
  T-less spline macro for P3.5 (Message 1 to 3 of 3)  
From: Fabien Mosen
Subject: T-less spline macro for P3.5
Date: 20 Aug 2002 16:16:11
Message: <3D62A22F.3040206@skynet.be>
I'd like to be able to convert a MegaPOV "3d_spline" (without T values)
into a P3.5 spline, with T values, while keeping the "constant time"
(equality of intervals) along the spline.

Does anyone knows about a #macro that would do that ?

Fabien.


Post a reply to this message

From: ingo
Subject: Re: T-less spline macro for P3.5
Date: 21 Aug 2002 12:06:23
Message: <Xns9271B8E1AE5A9seed7@povray.org>
in news:3D6### [at] skynetbe Fabien Mosen wrote:

> Does anyone knows about a #macro that would do that ?
> 
> 

Fabien,
I'm not sure if this is what you're looking for, as I've never used "the 
other" spline type in MegaPov.
The maco takes an array of points as input, it always expects one point 
before the start of the spline and one point beyond the end of it. The 
t-value will go from ...,0 - 1,...
SplType is a string to set the wanted type of spline (C/c/L/l/N/n/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/N/n/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 (78) //N  linear_spline
            natural_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
---%<------%<---

Ingo


Post a reply to this message

From: fabien
Subject: Re: T-less spline macro for P3.5
Date: 23 Aug 2002 06:59:08
Message: <3d66157c$1@news.povray.org>


> Fabien,
> I'm not sure if this is what you're looking for, as I've never used "the
> other" spline type in MegaPov.

Thanks, but it doesn't work as I would want.  Well, I finally, I've
written a specific #macro to place things at regular intervals along
an ordinary P3.5 spline.  Basically, it measures the length of the
spline by discrete integration, then runs along the spline and places an
object each time a given distance has been 'travelled'.  I'll
clean it and publish it here.

Fabien.


Post a reply to this message

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