POV-Ray : Newsgroups : povray.binaries.images : Thightening an iso? : Re: Thightening an iso? Server Time
14 Aug 2024 03:15:19 EDT (-0400)
  Re: Thightening an iso?  
From: Mark Weyer
Date: 16 Dec 2002 06:38:42
Message: <3DFDBDAE.DA9E4B5B@frege.mathematik.uni-freiburg.de>
>   I was wondering if any of you knew how to make the following red
> isosurface into something that look more like the yellow cylinder CSG?
> ie. scaling the sinusoidal shape of the isosurface, but keeping the
> small radius it has.

I assume you want to have a coil. Here is mine:

#macro pre_coil (l,r2,r1,steepness)
  #local rmax=(r1)+(r2);
  #local dmax=rmax*sqrt(2);
  #local omeg=(steepness)/(r2);
  #local pre_plane_stretch=1/(1+omeg*omeg);
  #local plane_stretch=sqrt(pre_plane_stretch);
  #local sqrsum=function(a,b) {a*a+b*b}
  #local sqrsum_=function(a,b,c) {a*a+b*b+c*c}
  #local coil_aux1=function(a_,b,c)
    {atanf(c*cos(a_)+b*sin(a_),b*cos(a_)-c*sin(a_))}
  #local coil_aux2=function(r,phi) {sqrsum(r-(r2),plane_stretch*r*phi)}
  isosurface {
    function {coil_aux2(sqrt(sqrsum(y,z)),coil_aux1(omeg*x,y,z))}
    contained_by {box {<0,-rmax,-rmax> <l,rmax,rmax>}}
    threshold (r1)*(r1)
    max_gradient 2*max(r2,sqrt(sqrsum_(
      (dmax-(r2)+pi*pi*pre_plane_stretch*dmax),
      (pi*pre_plane_stretch*dmax)
      (pi*omeg*pre_plane_stretch*dmax*dmax))))
    all_intersections
  }
#end

is wraps around the line from <0,0,0> to <l,0,0>.
r1 and r2 are like the small and large radius of a torus.
steepness is the ratio of swirling to moving:
0 gives a straight cylinder, 1 gives an angle of 45 degrees,
-1 also, but in the other direction.
The usual screw will have positive steepness.

Comments welcome.

  Mark


Post a reply to this message

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