Commit 73378a04 authored by Thomas's avatar Thomas

correction Geom::isPointInTriangle

parent be80cebc
......@@ -39,6 +39,8 @@ int main()
VEC3 tc(0,5,0);
VEC3 pIn1(1,1,0);
VEC3 pIn2(2,0,0);
VEC3 pIn3 = (tb+tc)/2.0f;
VEC3 pIn4 = (tc+ta)/2.0f;
VEC3 pOut(6,0,0);
if(Geom::isPointInTriangle<VEC3>(pIn1,ta,tb,tc)!=Geom::FACE_INCLUSION)
......@@ -51,6 +53,16 @@ int main()
std::cout << "ERROR : isPointInTriangle : edge inclusion" << std::endl;
}
if(Geom::isPointInTriangle<VEC3>(pIn3,ta,tb,tc)!=Geom::EDGE_INCLUSION)
{
std::cout << "ERROR : isPointInTriangle : edge inclusion" << std::endl;
}
if(Geom::isPointInTriangle<VEC3>(pIn4,ta,tb,tc)!=Geom::EDGE_INCLUSION)
{
std::cout << "ERROR : isPointInTriangle : edge inclusion" << std::endl;
}
if(Geom::isPointInTriangle<VEC3>(ta,ta,tb,tc)!=Geom::VERTEX_INCLUSION)
{
std::cout << "ERROR : isPointInTriangle : vertex inclusion" << std::endl;
......
......@@ -39,13 +39,13 @@ Inclusion isPointInTriangle(const VEC3& point,const VEC3& Ta,const VEC3& Tb,cons
VEC3 v1(Tb) ;
v1 -= Ta ;
VEC3 v2(point) ;
v1 -= Ta ;
v2 -= Ta ;
// Compute dot products
T dot00 = v0.norm2() ;
T dot00 = v0 * v0 ;
T dot01 = v0 * v1 ;
T dot02 = v0 * v2 ;
T dot11 = v1.norm2() ;
T dot11 = v1 * v1 ;
T dot12 = v1 * v2 ;
// Compute barycentric coordinates
......
......@@ -36,7 +36,7 @@ Orientation2D testOrientation2D(const VEC3& P, const VEC3& Pa, const VEC3& Pb)
typedef typename VEC3::DATA_TYPE T ;
// const T min = std::numeric_limits<T>::min()*T(100);
const T min = 0.0001;
const T min = 0.000001;
// T wsof = (Pa[0]-P[0])*(P[1]-Pb[1])-(P[0]-Pb[0])*(Pa[1]-P[1]);
T wsof = (P[0]-Pa[0])*(Pb[1]-Pa[1])-(Pb[0]-Pa[0])*(P[1]-Pa[1]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment