POV-Ray : Newsgroups : povray.general : Twist an isosurface : Re: Twist an isosurface Server Time
31 Jul 2024 22:09:26 EDT (-0400)
  Re: Twist an isosurface  
From: Thomas de Groot
Date: 22 Dec 2006 03:35:31
Message: <458b98d3@news.povray.org>
I have tweaked a bit some parts, but this works as it should:

#declare Bend=0.5;
#declare Sharpness=0.8;
#declare SolidHeart = 0;
#declare TwistHeart = 1;

 #if (!SolidHeart)
    #if (!TwistHeart)
     // Original untwisted version
     #declare Heart_Function =
       function { f_torus (y-pow(abs(x),Sharpness)*Bend, z*1, x, 0.8,0.1) }
    #else
      //Twisted version
      #declare K = 1; //twist angle
      #declare f = function (y){K*y}
      #declare Twist_x = function (x,y,z){( x*cos(f(y)) + z*sin(f(y)))}
      #declare Twist_z = function (x,y,z){(-x*sin(f(y)) + z*cos(f(y)))}

      #declare Heart_Function =
        function { f_torus (y-pow(abs(Twist_x(x,y,z)),Sharpness)*Bend, 
Twist_z(x,y,z)*1,Twist_x(x,y,z), 0.8,0.1) }
    #end
  #else
    #declare Heart_Function = function { f_sphere 
(y-pow(abs(x),Sharpness)*Bend, z*2, x, 0.6    ) }
  #end


Thomas


Post a reply to this message

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