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 03:50:16 EDT (-0400)
  Re: Isosurface and f_spiral - bug or feature?  
From: Bald Eagle
Date: 5 Oct 2017 19:20:01
Message: <web.59d6bdad808cf4025cafe28e0@news.povray.org>
You might also be interested in a completely different way of producing a spiral
image:

https://swiftcoder.wordpress.com/2010/06/21/logarithmic-spiral-distance-field/

I though the fading effect was pretty cool.  I don't understand it yet, but I
got it to work after fixing something positively ridiculous.

Just thought I'd post it here since it's such a radically different way of
visualizing it.


#version 3.7;
//------------------------------------------
// SDL for spiral distance field
// Bill Walker - October 2017
//------------------------------------------
global_settings {assumed_gamma 1}

#include "colors.inc"
#include "consts.inc"

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

camera {
 orthographic
 location <0, 0, -100>
 look_at  <0, 0,   0>
 right x*image_width
 up y*image_height
}

plane {z, 1 pigment {checker Gray20, White} scale 10}
light_source {<0, 10, -500> color White*0.5}

#macro Spiral (X, Y)
 #declare a=1;
 #declare b=0.5;
 // calculate the target radius and theta
  #local R = sqrt (X*X +Y*Y);

   // early exit if the point requested is the origin itself
 // to avoid taking the logarithm of zero in the next step
 #if (R = 0)
  0
 #else
  #local T = atan2 (Y, X);
  // calculate the floating point approximation for n
  #local n = (log(R/a)/b - T)/(tau);

  // find the two possible radii for the closest point
  #local upper_r = a * pow(e, b * (T + tau*ceil(n)));
  #local lower_r = a * pow(e, b * (T + tau*floor(n)));

  // return the minimum distance to the target point
  min (abs(upper_r - R), abs(R - lower_r))
 #end
#end


#for (i, -image_width/2, image_width/2)
 #for (j, -image_height/2, image_height/2)
  box { -0.5, 0.5 translate <i, j, 0> pigment {color rgb min(1, Spiral(i, j)/255
)} }
 #end
#end


Post a reply to this message

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