POV-Ray : Newsgroups : povray.binaries.images : #init_spline vs. linear spline: works but not what I expected : Re: #init_spline vs. linear spline: works but not what I expected Server Time
2 Oct 2024 16:28:08 EDT (-0400)
  Re: #init_spline vs. linear spline: works but not what I expected  
From: Lewis
Date: 10 Apr 2000 16:46:14
Message: <38F23D18.C5278ED1@netvision.net.il>
A while ago I tried to program a spline macro. I never succeded but one
of the parameters I wanted to take into account was a max x-y-z range
variable, which would help create splines within a specific range. The
other way I wanted to do (even better) was that the macro would
calculate a polynomial spline along the points you specify, adjusting
the degree (or other parameters) of the spline so that it actually
passes through the specified points, which would be Min and Max points
in the spline graph. Does anyone know if there is a spline that does
this, or how to do it? Of course it involves differential mathematics,
which I can handle well enough, but serious macro bugs always appear
which I never manage to fix.

"Greg M. Johnson" wrote:
> 
> I ran into some confusion as to how #init_spline works.  I was bothered
> for a while that it can give values far outside the range of data
> points.  But know I understand what's going on and there's no 'bug.'
> 
> I offer this demonstration just so you can know what to expect. I set up
> an #init_spline and a linear spline with the same data points.
> 
> ___________________________________________________
> 
> #version unofficial MegaPov 0.4
> #include "colors.inc"
> 
> #init_spline {"Lshininit",
> <0.00, -15>,
> <0.25, -125>,
> <0.45, -110>,
> <0.50, -10>,
> <0.75, -25>,
> <1.00, -15>
> }
> 
> #declare Lshinlinear=spline{
> linear_spline
> 0.00, -15,
> 0.25, -125,
> 0.45, -110,
> 0.50, -10,
> 0.75, -25,
> 1.00, -15
> }
> 
> #declare nn=0
> #while(nn<1)
> 
> sphere {<(nn+0.0025)*300,Lshinlinear(nn+0.0025).y,0>,2
>         pigment{Red}
>         finish{ambient 1}
>         }
> sphere {<nn*300,eval_spline ("Lshininit",nn),0>,2
>         pigment{Green}
>         finish{ambient 1}
>         }
> #declare nn=nn+.005;
> #end
> 
> camera
> {
>   location  <100, 0.5, -400>
>   look_at   <100, 0.0,  0.0>
> }
> 
>   ------------------------------------------------------------------------
>  [Image]


Post a reply to this message

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