POV-Ray : Newsgroups : povray.newusers : Spline : Re: Spline Server Time
29 Jul 2024 16:22:32 EDT (-0400)
  Re: Spline  
From: Mike Williams
Date: 15 Jun 2005 16:48:14
Message: <OOeA8GA0OJsCFwDM@econym.demon.co.uk>
Wasn't it Oleguer Vilella who wrote:
>I want a function to make 
>the surface go up and go down. I think a spline would be a good idea.
>
>What do you think Mike?

Perhaps something like this:


#version 3.6;

global_settings {assumed_gamma 1.0}

camera {location  <0,50,-160> look_at <0,0,0>}

background {rgb 1}

light_source {<-30, 100, -30> color rgb 1}

// ----------------------------------------

#include "colors.inc"

#declare S = function {
   spline {
     linear_spline
    -1.0, < 0.5, 0, 0>,
    -0.5, < 0,   0, 0>,
     0.01,< 0.2, 0, 0>,
     0.5, <-0.2, 0, 0>,
     1, <-0.2, 0, 0>
   }
 }

#declare Length = 100;
#declare Height = 50;
#declare Thickness = 10;

#declare  Q = function {y - Height*S(x/Length).x}

isosurface {
 function { abs(Q(x,y,z)) - Thickness  }
  max_gradient 2
  contained_by{box{ -<Length, Height+Thickness, Thickness> 
                     <Length, Height+Thickness, Thickness> }}
  pigment { color Green}
  finish { ambient 0.2 diffuse 0.8 phong 1 }
}  


This is rigged for the container box to just fit as long as the spline
values stay between -1.0 and +1.0.


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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