POV-Ray : Newsgroups : povray.newusers : prism along a curve : Re: prism along a curve Server Time
5 Sep 2024 04:16:23 EDT (-0400)
  Re: prism along a curve  
From: Mike Williams
Date: 23 Oct 2001 13:45:00
Message: <w6znDFAf9Y17EwYe@econym.demon.co.uk>
Here's a fixed version of my prism-along-a-spline parametric isosurface.
I had my x's and z's swapped somewhere. I've also drawn in the splines
that generate the surface, and done a bit of tidying up.

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

#version 3.5;

camera { location  <2, 0, -5> look_at <0, 0.25, 0> angle 25}

light_source {<100,200,-500> colour rgb 1}

// The open spline 
#declare S = function {
   spline {
     cubic_spline
      -1, < 0, 0.5, 0.0>,
    -0.5, < 0, 0.2, 0.4>,
    0.01, < 0, 0.2, 0.2>,
     0.5, < 0, 0.4, 0.4>,
       1, < 0, 0.0, 0.0>
   }
 }

// The closed spline (prism)
#declare S2 = function {
  spline {
    cubic_spline 
      -1, <0, 3, -5>, // control point
       // There's currently a bug with splines that have coordinate zero
       0.001, <0, 3,  5>, // So use 0.001 
       1, <0, -5,  0>,
       1.5 <0, 0, -3>,
       2, <0,  3, -5>,
       3, <0,  3,  5>, // closure
       4, <0, -5,  0>  // control point
    }
  }

#declare Fx = function(x,y) {u}
#declare Fy = function(x,y) {S(u).y + 0.08*S2(v).y}
#declare Fz = function(x,y) {S(u).z + 0.08*S2(v).z}
#declare Umin =  -1;
#declare Umax =  1;
#declare Vmin =  0;
#declare Vmax =  3;
#declare Iter_U = 100;
#declare Iter_V = 50;

#include "param.inc"
Parametric()

object {Surface
  pigment {rgb 1}
} 

#declare ctr = Umin;
#while (ctr < Umax)
  sphere {<ctr, S(ctr).y, S(ctr).z-0.22> ,.02  pigment { rgb <1,1,0> }}
  #declare ctr = ctr + 0.01;
#end

#declare ctr = Vmin;
#while (ctr < Vmax)
  sphere {<1, 0.08*S2(ctr).y, 0.08*S2(ctr).z> ,.02  pigment { rgb
<1,0,0> }}
  #declare ctr = ctr + 0.01;
#end


Post a reply to this message

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