POV-Ray : Newsgroups : povray.general : Need help generating a cylindrical solid : Re: Need help generating a cylindrical solid Server Time
29 Jul 2024 12:21:40 EDT (-0400)
  Re: Need help generating a cylindrical solid  
From: Christian Froeschlin
Date: 29 Aug 2012 19:09:13
Message: <503ea119$1@news.povray.org>
Chaanakya wrote:

> As opposed to the different colors being shown throughout the object, I am only
> seeing the different 'shells' on one side of the object, which is quite weird.

your problem is that your slab is not centered on the origin.
Therefore, your "scale 1.00001" resolves the coincident surface problem
for the inner surface in the opposite direction you're expecting.

You might try something like this:

#version 3.6;
#include "colors.inc"

global_settings {
   assumed_gamma 1.0
   ambient_light White
   max_trace_level 256
}

camera {
   location <0,1,3>
   look_at <0,0,0>
}

light_source {
   <100,100,0>
   color White
}

#declare base = difference
{
   cylinder { <-1,0,0>,<1,0,0>,1.5 }
   cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
   // center desired target part on origin
   translate -1.25*z
}

#declare curved = union
{
   #declare I = 1;
   #while (I < 5)
     #declare D = 0.1*I;
     intersection
     {
       object {base}
       difference
       {
         box {<-D,-D,-0.5>,              <D,D,0.5>}
         box {<-D+0.0999,-D+0.0999,-0.6>, <D-0.0999,D-0.0999,0.6>}
       }
       pigment {color <2*D,0,0>}
     }
     #declare I = I + 1;
   #end
}

object {curved}



Note that you can use cylinders instead of boxes if you
don't actually want the corners.

Also note that for ior the best approach might be to stack solids
without differencing away the insides. As long as each solid is
fully contained within the outer solid all light rays should
traverse the correct ior boundaries.


Post a reply to this message

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