POV-Ray : Newsgroups : povray.advanced-users : iso-round-cylinder - help? : iso-round-cylinder - help? Server Time
29 Jul 2024 04:32:53 EDT (-0400)
  iso-round-cylinder - help?  
From: Alf Peake
Date: 8 Jan 2003 18:56:09
Message: <3e1cba99@news.povray.org>
Has anyone got an answer to my problem please? Maybe just a typo in
the script?
http://www.peake42.freeserve.co.uk/pix2/iso-wood.jpg  12K
An isosurface rounded cylinder with a wood pigment added.

The torus is visible if the pigment proportion added is more than
around 1/500. I'm using random generated pigments, and was trying to
auto-calculate the proportion added according to the contrast of the
pigment.

Alf

--------------------

// Scene extract

camera{ location <1,1,-0.75>
   angle 10
   look_at <0, 0.15, -0.15>
}
light_source{ <-50,80,-50> 1.2 }

#declare TmpWood =
pigment{ wood sine_wave // Simple demo
   pigment_map{[0 rgb 0.7][1 rgb 0.3]}
}
#declare Fn_Pigm =
function{ pigment{ TmpWood } }

// Isosurface rounded_cylinder along z_axis.
#local Len = 0.2; // Cylinder length/2
#local RodR = 0.2; // Cylinder radius
#local Rmin = 0.03; // Rounding radius
#local Rmaj = RodR-Rmin; // For torus
#local Fn_Tmp = function {sqrt(x*x + z*z) }
#local C_Box = <RodR, RodR, Len>; // Contained_by/2

isosurface {
   function{
      min( // Merge 2*torus and 2*cylinders
         Fn_Tmp( sqrt(x*x + y*y) - Rmaj, y, abs(z) - Len+Rmin ) -
Rmin,
         max(  // Long thin cylinder
            abs(z) - Len,
            sqrt(x*x + y*y) - RodR+Rmin
         ),
         max(  // Short fat cylinder
            abs(z) - Len+Rmin,
            sqrt(x*x + y*y) - RodR
         )
      )
      // Low contrast pigment needed 100 divisor
      + Fn_Pigm(x,y,z).gray/100 // Wood pigment
   }
   contained_by { box { -C_Box, C_Box } }
   max_gradient 1.1
   accuracy 0.0005
   pigment{ rgb 0.8 } finish{ diffuse 0.8 }
}


Post a reply to this message

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