fix rounding issue in IsDegenerated() method
This commit is contained in:
parent
9e4de92ce1
commit
0ae92950f0
|
@ -390,12 +390,6 @@ void MeshGeomFacet::Enlarge (float fDist)
|
|||
|
||||
bool MeshGeomFacet::IsDegenerated(float epsilon) const
|
||||
{
|
||||
// if we do a strict test then compute the area
|
||||
if (epsilon == 0) {
|
||||
float fArea = Area();
|
||||
return fArea < epsilon;
|
||||
}
|
||||
|
||||
// The triangle has the points A,B,C where we can define the vector u and v
|
||||
// u = b-a and v = c-a. Then we define the line g: r = a+t*u and the plane
|
||||
// E: (x-c)*u=0. The intersection point of g and E is S.
|
||||
|
@ -415,16 +409,16 @@ bool MeshGeomFacet::IsDegenerated(float epsilon) const
|
|||
// BTW (u*u)*(v*v)-(u*v)*(u*v) is the same as (uxv)*(uxv).
|
||||
Base::Vector3f u = _aclPoints[1] - _aclPoints[0];
|
||||
Base::Vector3f v = _aclPoints[2] - _aclPoints[0];
|
||||
float eps = epsilon;
|
||||
float uu = u*u;
|
||||
if (uu < eps)
|
||||
double eps = epsilon;
|
||||
double uu = u*u;
|
||||
if (uu <= eps)
|
||||
return true;
|
||||
float vv = v*v;
|
||||
if (vv < eps)
|
||||
double vv = v*v;
|
||||
if (vv <= eps)
|
||||
return true;
|
||||
float uv = u*v;
|
||||
float crosssqr = uu*vv-uv*uv;
|
||||
if (crosssqr < eps*std::max<float>(uu,vv))
|
||||
double uv = u*v;
|
||||
double crosssqr = uu*vv-uv*uv;
|
||||
if (crosssqr <= eps*std::max<double>(uu,vv))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user