From 6a03b9d31cdc3fffd7423eac4e6e39ab51407ed4 Mon Sep 17 00:00:00 2001 From: ponchio Date: Wed, 1 Dec 2004 16:06:59 +0000 Subject: [PATCH] Distance --- vcg/space/sphere3.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vcg/space/sphere3.h b/vcg/space/sphere3.h index 0a325355..782cf3de 100644 --- a/vcg/space/sphere3.h +++ b/vcg/space/sphere3.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.5 2004/09/29 13:55:33 ponchio +Added Distance shpere - point. + Revision 1.4 2004/04/02 09:49:01 ponchio Ehm... a couople of small errors. @@ -84,6 +87,14 @@ template T Distance(const Sphere3 &sphere, return dist; } +template T Distance(const Sphere3 &sphere, + const Sphere3 &s) { + T dist = Distance(s.Center(), sphere.Center()) + - sphere.Radius() - s.Radius(); + if(dist < 0) dist = 0; + return dist; +} + typedef Sphere3 Sphere3f; typedef Sphere3 Sphere3d;