POV-Ray : Newsgroups : povray.newusers : Isosurface and f_spiral - bug or feature? : Re: Isosurface and f_spiral - bug or feature? Server Time
2 May 2024 00:55:56 EDT (-0400)
  Re: Isosurface and f_spiral - bug or feature?  
From: Bald Eagle
Date: 2 Oct 2017 21:00:00
Message: <web.59d2dffc808cf4025cafe28e0@news.povray.org>
So, I just wanted to mention a few other odd things I noticed in the internal
function code and my SDL emulation:

#declare Theta = atan2 (Z, X);
This returns an angle in RADIANS. I'm sure this is fine for the POV-Ray
isosurface code, but nowhere in my code do I see where I converted this to
DEGREES before rotating my spheres.  Oops.  :O

This little bit doesn't seem to need a special case for Shape = 1.

#if (Shape = 1)
  #declare r2 = sqrt(r2*r2 + Y*Y);

     #elseif (Shape != 0)
          #declare temp = 2/Shape;
          #declare r2 = pow( (pow(abs(r2), temp) + pow(abs(Y), temp)), 1/temp);

Because it seems to me they give the same result?


Anyway, I did the bleeding obvious, and just defined a function {} to be
rendered as an isosurface and noodled out ways to adjust the thickness of the
spirals, adjust the frequency of the spirals, and render multiple spirals.

As you can see, the regions near the origin get pinched, but I haven't had an
epiphany about how to address that (yet).  One of the mathemagicians here can
probably jump in with, "Oh! 'All you've got to do is' ...."

I left in the original function and a few of my experimental modifications.  The
straightforward spiral code is the uncommented line, and should run fine as-is.

I haven't implemented anything to adjust the cross-sectional shape of the spiral
arms (yet), but maybe this ought to be a good enough start for others to dabble
with.

I should probably add an evaluate directive in there just as a matter of good
habit...

==================================================================

#version 3.7;
//------------------------------------------
// SDL for isosurface spiral[s] based on equations by Gerd Platl
// http://k3dsurf.s4.bizhat.com/k3dsurf-ftopic30-0-asc-30.html
// Bill Walker - October 2017
//------------------------------------------
global_settings {assumed_gamma 1}
#include "colors.inc"

light_source { <-1,8,2> color White}

camera {
 location <0, 10, -10>
 look_at  <0, 0, 0>
}

plane {y, -1 pigment { checker Grey, White }}

#declare RADIUS = 5;
#declare Thickness = 0.1;
#declare Freq = 2;
#declare Spirals = 5;

isosurface {
 //function {Thickness - y*y - pow(sin((sqrt(x*x+z*z) - 0.5*atan2(z,x))),2)}
 //function {Thickness - max (y*y, x*z) - pow(sin((sqrt(x*x+z*z) -
0.5*atan2(z,x))),2)}
 //function {Thickness - y*y*Freq - pow(sin((sqrt(x*x+z*z)*Freq -
0.5*atan2(z,x))),2)}

 function {(Thickness - y*y*Freq - pow(sin(sqrt(x*x+z*z)*Freq -
(0.5*Spirals*atan2(z,x)) ),2))}
 //function {(Thickness - y*y*Freq - pow(sin(max(sqrt(x*x+z*z), 1)*Freq -
(0.5*Spirals*atan2(z,x)) ),2))}
 //function {(Thickness - y*y*Freq -
pow(sin(max(sqrt(x*x+z*z),1/sqrt(x*x+z*z))*Freq - (0.5*Spirals*atan2(z,x))
),2))}
 //function {0.05 - y*y - pow(sin((sqrt(x*x+z*z))),2) + pow(sin((sqrt(x*x+z*z) -
(11*atan2(z,x)))),2) }

 accuracy 0.01
 threshold 0 // default value
 max_gradient 102
 contained_by {sphere {<0,0,0>, RADIUS}}
 open
 texture {pigment {Red} finish {specular 0.4}}
   }


//sphere {<0,0,0>, RADIUS pigment {rgbt <0, 0.5, 0, 0.9>} no_shadow}  // show
contained_by sphere


Post a reply to this message

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