in SphereMode::Hit added a check on the sphere intersection, if no intersection, calculating distance could generate a NAN exception
This commit is contained in:
parent
8ca165bb98
commit
bf23eca7be
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.13 2005/06/29 15:22:26 callieri
|
||||||
|
changed the name of some intersection functions to avoid ambiguity
|
||||||
|
|
||||||
Revision 1.12 2005/02/11 11:44:07 tommyfranken
|
Revision 1.12 2005/02/11 11:44:07 tommyfranken
|
||||||
Trackball translation corrected
|
Trackball translation corrected
|
||||||
|
|
||||||
|
@ -225,9 +228,12 @@ Point3f SphereMode::Hit(Trackball *tb, const Point3f &p) {
|
||||||
IntersectionLinePlane<float>(vp, ln, hitPlane);
|
IntersectionLinePlane<float>(vp, ln, hitPlane);
|
||||||
Sphere3f sphere(tb->center,tb->radius);
|
Sphere3f sphere(tb->center,tb->radius);
|
||||||
bool resSp = IntersectionLineSphere<float>(sphere, ln, hitSphere1, hitSphere2);
|
bool resSp = IntersectionLineSphere<float>(sphere, ln, hitSphere1, hitSphere2);
|
||||||
if(Distance(viewpoint,hitSphere1)<Distance(viewpoint,hitSphere2))
|
if(resSp == true)
|
||||||
hitSphere=hitSphere1;
|
{
|
||||||
else hitSphere=hitSphere2;
|
if(Distance(viewpoint,hitSphere1)<Distance(viewpoint,hitSphere2))
|
||||||
|
hitSphere=hitSphere1;
|
||||||
|
else hitSphere=hitSphere2;
|
||||||
|
}
|
||||||
|
|
||||||
/*float dl=*/Distance(ln,tb->center);
|
/*float dl=*/Distance(ln,tb->center);
|
||||||
bool resHp = HitHyper(tb->center, tb->radius, viewpoint, vp, hitPlane, hitHyper) ;
|
bool resHp = HitHyper(tb->center, tb->radius, viewpoint, vp, hitPlane, hitHyper) ;
|
||||||
|
|
Loading…
Reference in New Issue