From 61084cf1ba342f2fa3355276296ba90c51fe38ac Mon Sep 17 00:00:00 2001 From: frohlich Date: Sun, 15 Mar 2009 12:50:24 +0000 Subject: [PATCH] Make triangle sphere intersection tests usable with mixes types. Modified Files: simgear/math/SGIntersect.hxx --- simgear/math/SGIntersect.hxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/simgear/math/SGIntersect.hxx b/simgear/math/SGIntersect.hxx index b2438dc6..6ffffeb8 100644 --- a/simgear/math/SGIntersect.hxx +++ b/simgear/math/SGIntersect.hxx @@ -743,9 +743,9 @@ inline SGVec3 closestPoint(const SGVec3& p, const SGTriangle& tri) { return closestPoint(tri, p); } -template +template inline bool -intersects(const SGTriangle& tri, const SGSphere& sphere) +intersects(const SGTriangle& tri, const SGSphere& sphere) { // This method minimizes the distance function Q(u, v) = || p - x || // where x is a point in the trialgle given by the vertices v_i @@ -753,7 +753,7 @@ intersects(const SGTriangle& tri, const SGSphere& sphere) // The theoretical analysis is somehow too long for a comment. // May be it is sufficient to see that this code passes all the tests. - SGVec3 off = tri.getBaseVertex() - sphere.getCenter(); + SGVec3 off = tri.getBaseVertex() - SGVec3(sphere.getCenter()); T baseDist2 = dot(off, off); T a = dot(tri.getEdge(0), tri.getEdge(0)); T b = dot(tri.getEdge(0), tri.getEdge(1)); @@ -954,9 +954,9 @@ intersects(const SGTriangle& tri, const SGSphere& sphere) } } } -template +template inline bool -intersects(const SGSphere& sphere, const SGTriangle& tri) +intersects(const SGSphere& sphere, const SGTriangle& tri) { return intersects(tri, sphere); } -- 2.39.5