|
|
Someone recently post an image with an image with two broken blobs
(I'm unable to see the thread).
I think I have found the origin of the bug.
In get_element_bounding_sphere from blob.c, if an element has
any transformation, the bounding sphere is also transformed.
here the buggy code:
if (Element->Trans != NULL)
{
r = sqrt(r2);
MTransPoint(C, C, Element->Trans);
Make_Vector(H, r, r, r);
MTransDirection(H, H, Element->Trans);
r = max(max(fabs(H[X]), fabs(H[Y])), fabs(H[Z]));
r2 = Sqr(r) + EPSILON;
}
Comments follow on the picture:
from a regular sphere of radius r (r2 is the square of the radius)
[translucent white sphere in the picture]
a vector is made [from the origin to the Magenta sphere at the corner of the
cyan box]
At the end, taking the greatest dimension of the vector would give back the
radius.
But the transformation (only scale/rotate, as it is a vector, translate are
ignored)
move the vector extremity (magenta ellipse on the yellow box)
The yellow box is the result of the transformation from the cyan box.
It is obvious (and exagerated on purpose on the picture) that taking the
coordinates
of the vector, sometimes (according to the transformations), is not correct to
define the
radius of a bounding sphere (the translucent ellipsoid is the result of the
transformation
of the first sphere : obviously, it won't fit in a sphere tangent to the vector
extremity.
The bug nature is odd:
With only rotate, it is ok
With only scale (uniform or not), it is ok
With a mix of uniform scale and rotate, it is ok
With a mix of non-uniform scale and rotate, it MAY be ok or NOT, according to
the parameters
(mainly of the transformations)
Post a reply to this message
Attachments:
Download 'bugblob1.jpg' (19 KB)
Preview of image 'bugblob1.jpg'
|
|
|
|
"J. Grimbert" wrote:
> Someone recently post an image with an image with two broken blobs
> (I'm unable to see the thread).
>
> I think I have found the origin of the bug.
>
> In get_element_bounding_sphere from blob.c, if an element has
> any transformation, the bounding sphere is also transformed.
>
> ... 8< ...Snip !
>
> The bug nature is odd:
> With only rotate, it is ok
> With only scale (uniform or not), it is ok
> With a mix of uniform scale and rotate, it is ok
> With a mix of non-uniform scale and rotate, it MAY be ok or NOT, according to
> the parameters
> (mainly of the transformations)
Thank you very much Grimbert for looking into
this problem.
I too found that the defects appeared when doing
some combinations of non uniform scaling and
rotations.
(This problem has been BUGGING me some time now)
And to any programming TAG members (E.g. Chris ?):
Should this problem be discussed further in
poray.general or can this now be considered to
be a bug ?
Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html
Post a reply to this message
|
|