POV-Ray : Newsgroups : povray.binaries.images : #init_spline vs. linear spline: works but not what I expected Server Time
2 Oct 2024 18:18:12 EDT (-0400)
  #init_spline vs. linear spline: works but not what I expected (Message 1 to 2 of 2)  
From: Greg M  Johnson
Subject: #init_spline vs. linear spline: works but not what I expected
Date: 10 Apr 2000 15:54:06
Message: <38F23050.3F37DEA1@my-dejanews.com>
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>
}


Post a reply to this message


Attachments:
Download 'splinebroke.jpg' (10 KB)

Preview of image 'splinebroke.jpg'
splinebroke.jpg


 

From: Lewis
Subject: Re: #init_spline vs. linear spline: works but not what I expected
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.