Dirk Reiners wrote:
        Hi Daniel,

On Tue, 2004-01-13 at 03:04, Daniel Grest wrote:

Hello,

i just found a bug in the Volume intersection methods (OSGVolumeFunctions.cpp).

For the intersection with the CylinderVolumes/Sphere and Cyl/Box there is missing this check:

  s1 = (apos        - sphere.getCenter()).length();
  s2 = (apos + adir - sphere.getCenter()).length();

// to be added:
 if ((s1<=DBL_EPSILON) || (s2<=DBL_EPSILON)) return true;

otherwise u might divide by zero.


For Sphere/Cyl I can see that, but for the box the only division I see
is by the cylinder axis length, which is not influenced by the above
calculation. Am I missing something. Anyway, thanks for the fix.
According the box: Sorry, I just guessed it must be the same, didn't look close.


Also i couldn't find the function which is called for CylinderVolume.intersect(SphereVolume).
In the OSGVolumeFunctions.cpp there is a intersect(CylinderVol, Volume),
but i couldn't find a intersect(CylinderVol, SphereVol) ?
And i dont see why the intersect(SphereVol, CylinderVol) should be called. As far as i saw the intersect(CylinderVol, Volume) should call itself for a Sphere, which is not happening... ???


Yes, that's a little tricky. We have some inlined parameter turnaround
functions in OSGVolumeFunctions.inl, like the following

inline
bool intersect(const CylinderVolume &cylinder, const SphereVolume
&sphere)
{
    return intersect(sphere, cylinder);
}

These are just to remove the symmetries and reduce the number of actual
intersect functions we need.
Ah, now I see ;) Thanks.

Thanks

        Dirk






-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users


--
        A novice asked the master: "I have a program that sometimes runs and
sometimes aborts. I have followed the rules of programming, yet I am totally
baffled. What is the reason for this?"
        The master replied: "You are confused because you do not understand
the Tao.  Only a fool expects rational behavior from his fellow humans.  Why
do you expect it from a machine that humans have constructed?  Computers
simulate determinism; only the Tao is perfect.
        The rules of programming are transitory; only the Tao is eternal.
Therefore you must contemplate the Tao before you receive enlightenment."
        "But how will I know when I have received enlightenment?" asked the
novice.
        "Your program will then run correctly," replied the master.
                -- Geoffrey James, "The Tao of Programming"



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to