POV-Ray : Newsgroups : povray.bugreports : Bug in superellipsoid Server Time
31 Oct 2024 16:17:26 EDT (-0400)
  Bug in superellipsoid (Message 1 to 1 of 1)  
From: Peter J  Holzer
Subject: Bug in superellipsoid
Date: 16 Aug 2000 07:57:59
Message: <399a81c7@news.povray.org>
This bug report is a summary of the discussion in povray.general with
the same subject. I discovered the bug (although I wasn't the first one,
I think), J. Grimbert <jgr### [at] atos-groupcom> analysed it and found
the fix. I checked his fix and believe it to be correct.

The superellipsoid code uses the intersect_box() function to determine
if and where a ray (given by a point P and a direction D) intersects the
bounding box around the superellipsoid. It returns a boolean value, and
sets *dmin and *dmax to the distances of the two intersection points
from P. 

This is done by computing the distance of the intersection points with
planes perpendicular to the x, y, and z axis and replacing the previous
values of *dmin and *dmax iff the new values are better. tmin and tmax
are used in the y and z cases to hold the new values.

At the end of the "z" block, *dmin and *dmax have the correct values, 
and tmin and tmax may or may not have the correct values. For example,
if the ray is parallel to the x axis, tmin and tmax aren't computed at
all, and cannot have the correct value (this is the case where I noticed
the bug - with a superellipsoid at the origin and an orthogonal camera
at the x axis all the rays are parallel to the x axis and the
superellipsoid is completely invisible).

Nevertheless, at this point *dmin and *dmax are unconditionally
overwritten with the values of tmin and tmax. This is wrong and should
simply be omitted.

Here is a patch for povray 3.1g for Unix, but it should apply cleanly to
other versions.

--- super.c.orig	Sat May  1 15:01:29 1999
+++ super.c	Tue Aug 15 14:20:14 2000
@@ -1040,9 +1040,6 @@
     }
   }
 
-  *dmin = tmin;
-  *dmax = tmax;
-
   return(TRUE);
 }
 
	hp


-- 
   _  | Peter J. Holzer    | Nicht an Tueren mangelt es,
|_|_) | Sysadmin WSR       | sondern an der Einrichtung (aka Content).
| |   | hjp### [at] wsracat      |    -- Ale### [at] univieacat
__/   | http://www.hjp.at/ |       zum Thema Portale in at.linux


Post a reply to this message

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