POV-Ray : Newsgroups : povray.newusers : prism along a curve : Re: prism along a curve Server Time
5 Sep 2024 04:19:40 EDT (-0400)
  Re: prism along a curve  
From: Mike Williams
Date: 23 Oct 2001 00:50:12
Message: <Ud3eKAAMYP17EwOW@econym.demon.co.uk>
Wasn't it John Bradshaw who wrote:
>Does anyone know of a way to make a prism-type object along a spline instead
>of along the z axis. In other words, how do you sweep a closed spline along
>another spline?

In 3.5 it might be possible to use a variation of the technique I use at
<http://www.econym.demon.co.uk/isotut/more.htm>.

The third image on that page shows an open spline being swept along
another open spline, and the bottom image shows a circle being swept
along a closed spline. Combining the two effects might be a little more
tricky. 

This is about as close as I can manage at the moment. There's still
something wrong. The closed spline seems to turn itself inside out in
the middle and I can't quite see why at the moment.

I've used Ingo Janssen's param.inc file to speed up the rendering
instead of using true parametric isosurfaces.

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

camera { location  <4, 0, -5> look_at <0, 0.25, 0> angle 17}

light_source {<100,200,-100> 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.6>
   }
 }

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

#declare Fx = function(x,y) {u      + 0.05*S2(v).x}
#declare Fy = function(x,y) {S(u).y + 0.05*S2(v).y}
#declare Fz = function(x,y) {S(u).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}
}


Post a reply to this message

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