From de99d5c2d9ef6e48cef44367d2275a52263637eb Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Tue, 8 May 2007 13:49:08 +0000 Subject: [PATCH] corrected error on intersection line-circle --- vcg/space/intersection2.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/vcg/space/intersection2.h b/vcg/space/intersection2.h index 48347ab7..c3ec6472 100644 --- a/vcg/space/intersection2.h +++ b/vcg/space/intersection2.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.6 2007/05/08 12:11:58 pietroni +added circle-line intersection + ****************************************************************************/ @@ -214,17 +217,19 @@ template //intersection between a circle and a line template inline bool CircleLineIntersection(const vcg::Line2 & line, - const vcg::Point2 ¢er, - const ScalarType &radius, - vcg::Point2 &p0, - vcg::Point2 &p1) + const vcg::Point2 ¢er, + const SCALAR_TYPE &radius, + vcg::Point2 &p0, + vcg::Point2 &p1) { + typedef typename SCALAR_TYPE ScalarType; + ///translate with origin on the center ScalarType x1,x2,y1,y2; - x1=p.X()-center.X(); - y1=p.Y()-center.Y(); - x2=x1+line.Direction.X(); - y2=y1+line.Direction.Y(); + x1=line.Origin().X()-center.X(); + y1=line.Origin().Y()-center.Y(); + x2=x1+line.Direction().X(); + y2=y1+line.Direction().Y(); ScalarType dx,dy,dr,D,delta,sign; dx=x2-x1;