POV-Ray : Newsgroups : povray.general : Spherical Sweep Along a Parametric Curve : Re: Spherical Sweep Along a Parametric Curve Server Time
31 Jul 2024 16:17:56 EDT (-0400)
  Re: Spherical Sweep Along a Parametric Curve  
From: Mike Williams
Date: 25 Nov 2006 06:43:17
Message: <qVd5KOAhoCaFFwau@econym.demon.co.uk>
Wasn't it Randall Sawyer who wrote:
>Spherical Sweep Along a Parametric Curve

Have you considered using a sphere_sweep?

#declare A=2;
#declare B=1.5;
#declare R=0.2;

#declare fx = function(x) { A*sin(x)}
#declare fy = function(y) {0}
#declare fz = function(z) { B*cos(z)}

#declare Steps = 20;

sphere_sweep {
  b_spline
  Steps+3,
  #local i=0;
  #while (i<Steps+3)
    #local a = 2*pi*i/Steps;
    <fx(a), fy(a), fz(a)>, R
    #local i=i+1;
  #end
  //tolerance 1.0e-4
  pigment {rgb <1,1,0>}
}

If you use a high value for Steps then you may need to use a tollerance
setting to avoid ugly artefacts.

The "Steps+3" bit allows for the additional control points required for
b_spline or cubic_spline so that you get a closed loop. If using
linear_spline then you only need Steps+1, but you also need a very high
value of Steps to make it look smooth, and then you get awful artefacts
that can't be got rid of by setting tolerance.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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