POV-Ray : Newsgroups : povray.text.scene-files : Re: Help - problems with scaling sphere and cylinder : Re: Help - problems with scaling sphere and cylinder Server Time
29 Jul 2024 02:28:36 EDT (-0400)
  Re: Help - problems with scaling sphere and cylinder  
From: JK
Date: 25 Aug 1998 18:26:43
Message: <35E32AFC.A537F7D1@hotmail.com>
Andrew Hedges wrote:

> Can somebody point out if I'm being stupid or doing something wrong
> here? I'm trying to create a pillar out of a union of a vertical
> cylinder topped with a sphere to round off the end, and so obviously the
> cylinder and the sphere need the same radius. This works ok when the
> value I'm using for the radii is greater than about 0.1, but when I get
> down to small numbers (like 0.01) the sphere comes out looking smaller
> than the cylinder. What's going on?
>
> I hope someone can help. Thanks.
>
> Here's the code I'm using (ajhmeter is an adjustable scaling factor):
>
> //-- begin code --
> #include "colors.inc"
>
> #declare ajhmeter=0.1
>
> camera
> {
>   location  <0.0, 1.2*ajhmeter, -2*ajhmeter>
>   direction 1.5*z
>   right     4/3*x
>   look_at   <0.0, ajhmeter,  0.0>
> }
>
> light_source {
>   0*x
>   color red 1.0  green 1.0  blue 1.0
>   translate <-30, 30, -30>
> }
>
> plane { y, -1 pigment {color rgb <0.7,0.5,0.3>}}
>
> union {
>   sphere { <0, ajhmeter*1, 0>, ajhmeter*0.1  pigment {Blue} }
>   cylinder { <0, 0, 0>, <0, ajhmeter*1, 0>, ajhmeter*0.1 pigment {Red} }
> }
>
> //-- end code --
>
> Andrew

Take a look at the scene without the cylinder:  AJHmeter less than about
0.032-> no sphere visible anymore. It seems that POV can handle small radii
for cylinders better than for spheres. This is easily explained: a sphere in
POV does consist of lots of flat pieces (but (phong)shaded so you don't
notice). At small radii, these planes have to be infintely smaller even.
There is this EPSILON value... it's a number (often 1e-10 or so) that is
considered 0 (!) by the computer or POV. Maybe this value is intruding here.
Anyway, it seems to be a simple floating-point "bug".

Just curious... why would you ever need a sphere with a radius of less than
0.0032? Why not scale the whole scene up by 10, or 100... then you don't
have any problems.

JK
--
http://surf.to/jkhome


Post a reply to this message

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