POV-Ray : Newsgroups : povray.binaries.images : #init_spline vs. linear spline: works but not what I expected : #init_spline vs. linear spline: works but not what I expected Server Time
2 Oct 2024 16:30:21 EDT (-0400)
  #init_spline vs. linear spline: works but not what I expected  
From: Greg M  Johnson
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


 

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