POV-Ray : Newsgroups : povray.text.scene-files : Re: Help - problems with scaling sphere and cylinder Server Time
29 Jul 2024 00:28:22 EDT (-0400)
  Re: Help - problems with scaling sphere and cylinder (Message 1 to 4 of 4)  
From: JK
Subject: Re: Help - problems with scaling sphere and cylinder
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

From: Nieminen Mika
Subject: Re: Help - problems with scaling sphere and cylinder
Date: 26 Aug 1998 12:09:38
Message: <35e42532.0@news.povray.org>
JK <kla### [at] hotmailcom> wrote:
: a sphere in
: POV does consist of lots of flat pieces (but (phong)shaded so you don't
: notice).

  Doh!
  AFAIK povray calculates mathematically perfect spheres, like a real
raytracer, not polyhedrons made of triangles like some scanline renderers.
(the mathematical intersection of a line and a sphere is easy to calculate)
  You have to prove your allegation.

-- 
                                                              - Warp. -


Post a reply to this message

From: JK
Subject: Re: Help - problems with scaling sphere and cylinder
Date: 26 Aug 1998 17:48:38
Message: <35E47386.7A6BA0E7@hotmail.com>
Nieminen Mika wrote:

> JK <kla### [at] hotmailcom> wrote:
> : a sphere in
> : POV does consist of lots of flat pieces (but (phong)shaded so you don't
> : notice).
>
>   Doh!
>   AFAIK povray calculates mathematically perfect spheres, like a real
> raytracer, not polyhedrons made of triangles like some scanline renderers.
> (the mathematical intersection of a line and a sphere is easy to calculate)
>   You have to prove your allegation.
>
> --
>                                                               - Warp. -

  Oh, you're being so nice to me.
OK, I'll have to admit that I didn't know this for a fact... and it seems I was
wrong. (Lots of other 3d programs use polyhedrons, though... the assumption
that POV did as well was wrong, and now that I think about it, it would be
strange if POV would use those, since POV uses mathematical formulas (as
clearly visible in the Poly object) to calculate objects.

So here it is: Nieminen Mika, you're right (... as if you didn't know already
huh? ;-)

But hey, I was in a state of despair: there was really something weird going
on. Since you're into the inner workings of POV, maybe you know the answer. Or
perhaps I was right about at least one thing. Now I'm really curious... Is it a
bug or not?
(take a look at the source Andrew Hedges gave)

JK


Post a reply to this message

From: Andrew Hedges
Subject: Re: Help - problems with scaling sphere and cylinder
Date: 27 Aug 1998 09:50:57
Message: <35E5562B.4516BEC7@open.ac.uk>
Wow! Weird to see your own name pop up 9 months after asking a question!
As to why I wanted such a small numerical value for the radius, at the
time I was trying to produce a scene for the POV City project and the
scale to be used was fixed (I think at the time it was something like 1
POV unit to 25m). This led to some things having way small dimensions,
hence the problem.

Anyway, POV City has since folded and I changed my mind about what the
scene was going to contain, so I'm not too bothered now. It's still
weird though...

Andrew

JK wrote:
> 
> Nieminen Mika wrote:
> 
> > JK <kla### [at] hotmailcom> wrote:
> > : a sphere in
> > : POV does consist of lots of flat pieces (but (phong)shaded so you don't
> > : notice).
> >
> >   Doh!
> >   AFAIK povray calculates mathematically perfect spheres, like a real
> > raytracer, not polyhedrons made of triangles like some scanline renderers.
> > (the mathematical intersection of a line and a sphere is easy to calculate)
> >   You have to prove your allegation.
> >
> > --
> >                                                               - Warp. -
> 
>   Oh, you're being so nice to me.
> OK, I'll have to admit that I didn't know this for a fact... and it seems I was
> wrong. (Lots of other 3d programs use polyhedrons, though... the assumption
> that POV did as well was wrong, and now that I think about it, it would be
> strange if POV would use those, since POV uses mathematical formulas (as
> clearly visible in the Poly object) to calculate objects.
> 
> So here it is: Nieminen Mika, you're right (... as if you didn't know already
> huh? ;-)
> 
> But hey, I was in a state of despair: there was really something weird going
> on. Since you're into the inner workings of POV, maybe you know the answer. Or
> perhaps I was right about at least one thing. Now I'm really curious... Is it a
> bug or not?
> (take a look at the source Andrew Hedges gave)
> 
> JK


Post a reply to this message

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