Corrected metric for DSO picking

ver1_5_1
Toti 2007-01-05 20:35:35 +00:00
parent 11b26cdf45
commit a50d014056
2 changed files with 6 additions and 6 deletions

View File

@ -111,9 +111,9 @@ void DeepSkyObject::setInfoURL(const string& s)
bool DeepSkyObject::pick(const Ray3d& ray,
double& distanceToPicker,
double& distanceToBoundCenter) const
double& cosToBoundCenter) const
{
return testIntersection(ray, Sphered(position, (double) radius), distanceToPicker, distanceToBoundCenter);
return testIntersection(ray, Sphered(position, (double) radius), distanceToPicker, cosToBoundCenter);
}

View File

@ -57,11 +57,11 @@ template<class T> bool testIntersection(const Ray3<T>& ray,
template<class T> bool testIntersection(const Ray3<T>& ray,
const Sphere<T>& sphere,
T& distanceToTester,
T& distanceToCenter)
T& cosToCenter)
{
if (testIntersection(ray, sphere, distanceToTester))
{
distanceToCenter = (sphere.center - ray.origin - ray.direction*distanceToTester).length();
cosToCenter = (sphere.center - ray.origin)*ray.direction/(sphere.center - ray.origin).length();
return true;
}
return false;
@ -114,11 +114,11 @@ template<class T> bool testIntersection(const Ray3<T>& ray,
template<class T> bool testIntersection(const Ray3<T>& ray,
const Ellipsoid<T>& ellipsoid,
T& distanceToTester,
T& distanceToCenter)
T& cosToCenter)
{
if (testIntersection(ray, ellipsoid, distanceToTester))
{
distanceToCenter = (ellipsoid.center - ray.origin - ray.direction*distanceToTester).length();
cosToCenter = (ellipsoid.center - ray.origin)*ray.direction/(ellipsoid.center - ray.origin).length();
return true;
}
return false;