Triangle3<T> replaced by TRIANGLE
Segment<T> replaced by EDGETYPE
This commit is contained in:
parent
2c0875381b
commit
bd4dad797c
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$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
|
Revision 1.2 2004/04/26 12:34:50 ganovelli
|
||||||
plane line
|
plane line
|
||||||
plane segment
|
plane segment
|
||||||
|
@ -101,8 +104,11 @@ inline bool Intersection( const Plane3<T> & pl, const Line3<T> & li, Point3<T> &
|
||||||
}
|
}
|
||||||
|
|
||||||
/// intersection between segment and plane
|
/// intersection between segment and plane
|
||||||
template<class T>
|
template<typename SEGMENTTYPE>
|
||||||
inline bool Intersection( const Plane3<T> & pl, const Segment3<T> & sg, Point3<T> & po){
|
inline bool Intersection( const Plane3<typename SEGMENTTYPE::ScalarType> & pl,
|
||||||
|
const SEGMENTTYPE & sg,
|
||||||
|
Point3<typename SEGMENTTYPE::ScalarType> & po){
|
||||||
|
typedef typename SEGMENTTYPE::ScalarType T;
|
||||||
const T epsilon = T(1e-8);
|
const T epsilon = T(1e-8);
|
||||||
|
|
||||||
T k = pl.Direction() * (sg.P1()-sg.P0());
|
T k = pl.Direction() * (sg.P1()-sg.P0());
|
||||||
|
@ -117,8 +123,11 @@ inline bool Intersection( const Plane3<T> & pl, const Segment3<T> & sg, Point3<T
|
||||||
|
|
||||||
/// intersection between plane and triangle
|
/// intersection between plane and triangle
|
||||||
// not optimal: uses plane-segment intersection (and the fact the two or none edges can be intersected)
|
// not optimal: uses plane-segment intersection (and the fact the two or none edges can be intersected)
|
||||||
template<class T, class TRIANGLE >
|
template<typename TRIANGLETYPE>
|
||||||
inline bool Intersection( const Plane3<T> & pl, const TRIANGLE & tr, Segment3<T> & sg){
|
inline bool Intersection( const Plane3<typename TRIANGLETYPE::ScalarType> & pl,
|
||||||
|
const TRIANGLETYPE & tr,
|
||||||
|
Segment3<typename TRIANGLETYPE::ScalarType> & sg){
|
||||||
|
typedef typename TRIANGLETYPE::ScalarType T;
|
||||||
if(Intersection(pl,Segment3<T>(tr.P(0),tr.P(1)),sg.P0())){
|
if(Intersection(pl,Segment3<T>(tr.P(0),tr.P(1)),sg.P0())){
|
||||||
if(Intersection(pl,Segment3<T>(tr.P(0),tr.P(2)),sg.P1()))
|
if(Intersection(pl,Segment3<T>(tr.P(0),tr.P(2)),sg.P1()))
|
||||||
return true;
|
return true;
|
||||||
|
@ -139,8 +148,8 @@ inline bool Intersection( const Plane3<T> & pl, const TRIANGLE & tr, Segment3<T
|
||||||
}
|
}
|
||||||
|
|
||||||
/// intersection between two triangles
|
/// intersection between two triangles
|
||||||
template<class T>
|
template<typename TRIANGLETYPE>
|
||||||
inline bool Intersection( Triangle3<T> t0,Triangle3<T> t1){
|
inline bool Intersection( const TRIANGLETYPE & t0,const TRIANGLETYPE & t1){
|
||||||
return NoDivTriTriIsect(t0.P0(0),t0.P0(1),t0.P0(2),
|
return NoDivTriTriIsect(t0.P0(0),t0.P0(1),t0.P0(2),
|
||||||
t1.P0(0),t1.P0(1),t1.P0(2));
|
t1.P0(0),t1.P0(1),t1.P0(2));
|
||||||
}
|
}
|
||||||
|
@ -158,9 +167,9 @@ inline bool Intersection( Point3<T> V0,Point3<T> V1,Point3<T> V2,
|
||||||
return tri_tri_intersect_with_isectline(V0,V1,V2,U0,U1,U2,
|
return tri_tri_intersect_with_isectline(V0,V1,V2,U0,U1,U2,
|
||||||
coplanar,isectpt1,isectpt2);
|
coplanar,isectpt1,isectpt2);
|
||||||
}
|
}
|
||||||
template<class T>
|
template<typename TRIANGLETYPE,typename SEGMENTTYPE >
|
||||||
inline bool Intersection( Triangle3<T> t0,Triangle3<T> t1,bool &coplanar,
|
inline bool Intersection( const TRIANGLETYPE & t0,const TRIANGLETYPE & t1,bool &coplanar,
|
||||||
Segment3<T> & sg){
|
SEGMENTTYPE & sg){
|
||||||
Point3<T> ip0,ip1;
|
Point3<T> ip0,ip1;
|
||||||
return tri_tri_intersect_with_isectline(t0.P0(0),t0.P0(1),t0.P0(2),
|
return tri_tri_intersect_with_isectline(t0.P0(0),t0.P0(1),t0.P0(2),
|
||||||
t1.P0(0),t1.P0(1),t1.P0(2),
|
t1.P0(0),t1.P0(1),t1.P0(2),
|
||||||
|
|
Loading…
Reference in New Issue