diff --git a/vcg/space/intersection3.h b/vcg/space/intersection3.h index 3d28a375..f0ba8cb6 100644 --- a/vcg/space/intersection3.h +++ b/vcg/space/intersection3.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.3 2004/04/29 10:48:44 ganovelli +error in plane segment corrected + Revision 1.2 2004/04/26 12:34:50 ganovelli plane line plane segment @@ -101,8 +104,11 @@ inline bool Intersection( const Plane3 & pl, const Line3 & li, Point3 & } /// intersection between segment and plane -template -inline bool Intersection( const Plane3 & pl, const Segment3 & sg, Point3 & po){ +template +inline bool Intersection( const Plane3 & pl, + const SEGMENTTYPE & sg, + Point3 & po){ + typedef typename SEGMENTTYPE::ScalarType T; const T epsilon = T(1e-8); T k = pl.Direction() * (sg.P1()-sg.P0()); @@ -117,8 +123,11 @@ inline bool Intersection( const Plane3 & pl, const Segment3 & sg, Point3 -inline bool Intersection( const Plane3 & pl, const TRIANGLE & tr, Segment3 & sg){ +template +inline bool Intersection( const Plane3 & pl, + const TRIANGLETYPE & tr, + Segment3 & sg){ + typedef typename TRIANGLETYPE::ScalarType T; if(Intersection(pl,Segment3(tr.P(0),tr.P(1)),sg.P0())){ if(Intersection(pl,Segment3(tr.P(0),tr.P(2)),sg.P1())) return true; @@ -139,8 +148,8 @@ inline bool Intersection( const Plane3 & pl, const TRIANGLE & tr, Segment3 -inline bool Intersection( Triangle3 t0,Triangle3 t1){ +template +inline bool Intersection( const TRIANGLETYPE & t0,const TRIANGLETYPE & t1){ return NoDivTriTriIsect(t0.P0(0),t0.P0(1),t0.P0(2), t1.P0(0),t1.P0(1),t1.P0(2)); } @@ -158,9 +167,9 @@ inline bool Intersection( Point3 V0,Point3 V1,Point3 V2, return tri_tri_intersect_with_isectline(V0,V1,V2,U0,U1,U2, coplanar,isectpt1,isectpt2); } -template -inline bool Intersection( Triangle3 t0,Triangle3 t1,bool &coplanar, - Segment3 & sg){ +template +inline bool Intersection( const TRIANGLETYPE & t0,const TRIANGLETYPE & t1,bool &coplanar, + SEGMENTTYPE & sg){ Point3 ip0,ip1; return tri_tri_intersect_with_isectline(t0.P0(0),t0.P0(1),t0.P0(2), t1.P0(0),t1.P0(1),t1.P0(2),