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;