User talk:BernardH~commonswiki

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Hi. Is it possible to share your povray code for http://commons.wikimedia.org/wiki/File:Alexander_horned_sphere.png with us? Thanks, Guido

Here it is:

global_settings {
  assumed_gamma 1
}

camera {
  location <0,3.35,-3.5>
  right (4/3)*x
  up y
  look_at <0, 1.3, 0>
  angle 40
}

light_source {
  <4.5,8,-8>
  color rgb <1,1,1>
}

#declare r = 0.03;					    // torus minor radius
#declare k = 0.5;					    // scale when incrementing level
#declare theta = 75;					    // angle of torus slice removed
#declare level_max = 6;
#declare p1 = <sin(theta*pi/180/2), 1+cos(theta*pi/180/2), 0>;
#declare p2 = <-sin(theta*pi/180/2), 1+cos(theta*pi/180/2), 0>;

#declare torus_section = union {
  difference {
    torus {
      1, r
      rotate 90*x
      translate y
    }
    prism {
      -1.01*r, 1.01*r, 4
      <0,0>, 
      2*<sin(theta*pi/180/2), cos(theta*pi/180/2)>, 
      2*<-sin(theta*pi/180/2), cos(theta*pi/180/2)>
      <0,0>
      rotate -90*x
      translate y
    }
  }
  sphere {
    p1, r
  }
  sphere {
    p2, r
  }
  finish { ambient 0.1 diffuse 0.6 specular 0.6 roughness 0.05 metallic }
}

#macro recursive_torus(L)
#if (L < 5)
  #local c = rgb (<1,0.15,0>*(5-L) + <1,1,0>*L)/5;
#else
  #local c = rgb <1,1,0>;
#end
#if (L = level_max)
  object {
    torus_section
    pigment { c }
  }
#else
  union {
    object {
      torus_section
      pigment { c }
    }
    object {
      recursive_torus(L+1)
      scale k
      rotate 90*z
      translate p1
    }
    object {
      recursive_torus(L+1)
      scale k
      rotate 90*y
      rotate -90*z
      translate p2
    }
  }
#end
#end

object {
  recursive_torus(0)
  translate r*y
}

plane {
  y, 0
  pigment {rgb <0.2,0.2,0.8>}
  finish { ambient 0.1 diffuse 0.6 }
}

--88.163.238.178 22:25, 1 January 2010 (UTC)[reply]

Great. So many thanks. Guido

Your account will be renamed

[edit]

20:00, 17 March 2015 (UTC)

Renamed

[edit]

02:05, 21 April 2015 (UTC)