POV-Ray : Newsgroups : povray.general : Bug in superellipsoid : Re: Bug in superellipsoid Server Time
9 Aug 2024 09:05:52 EDT (-0400)
  Re: Bug in superellipsoid  
From: J  Grimbert
Date: 11 Aug 2000 07:21:17
Message: <3993E1A6.1649D60D@atos-group.com>
Warp wrote:
> 
> J. Grimbert <jgr### [at] atos-groupcom> wrote:
> : second image (super2.png) illustrates the same aspect of the bug
> : with a default camera. please notice the single pixel at the
> : very center of the picture: it is the background !!!
> 
>   This looks like at that point there's a mathematically undefined point
> (exactly like trying to render the function 1/x: it will have this kind of
> discontinuity at x=0).
> 

But there is no such discontinuity for the superellipsoid.
It is bounded by a 2 unit sized box and should not escape it;
(Let's me add, the surface of the superellipsoid is continuous,
it's not an object with holes.)

> : *dmin = tmin;
> : *dmax = tmax;
> 
> : The correction is simple: remove these two lines.
> 
>   Are you sure this will not break anything?

Short answer:

    Yes


Long answer:

   In the intersect_box() code of super.c, the aims of
the function is to compute the length from the origin
on the current ray of the two possible intersections with a
box (-1,1) and to order them correctly (hence the max and min
suffixes everywhere)

The intersect_box() itself is made of three big IF block:
one for the X axis, one for the Y axis and one for the Z axis.
For each axis, the intersection is looked for the two planes of
the axis (-1 and 1).
The reuse of tmin and tmax is a potential source of error, because in
the first IF block, tmin and tmax should rather be called xtmax and
xtmin (I guess the t is for temporary). 
As well in the second IF block, they should be ytmax and ytmin;
and in the third and last block, it should be ztmax and ztmin.
At the end of every IF block, the current lengths found (*dmin and
*dmax) are compared with the new intersection. If the intersection
is better suited, the *dmin or/and *dmax are updated.

Now, could you tell me, if I do the replacement inside each IF blocks,
which variables must be used for the two suspected lines ?
Is it xtmax, ytmax or ztmax ?
And why their values would be better than the work done by the
complex IF blocks ?

The fact is that when the code reach these two lines, 
the *dmin and *dmax are already correct, and (it become worst),
sometimes tmin and tmax have the same values (so it does not 
show as a bug), and sometimes tmin and tmax have not
good values (but the z IF block knews that, and did not use
them directly), so the bug shows its missing head !

And to make matter worst, these two lines are not always reached
(often an IF block does the return!).


Medium Answer:

  Yes, the intersect_box code is only used by the superellipoid, so other
objects do not share it. 
 Making the modification still allows to render superellipoid and does
 correct the problems shown by the previous version.
 What do you want more ?


Post a reply to this message

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