mirror of https://github.com/CGAL/cgal
Bugfix in function that test if a face is convex.
This commit is contained in:
parent
21012cb0a3
commit
ed0c55df89
|
|
@ -372,15 +372,13 @@ public:
|
||||||
|
|
||||||
if (m_points_of_face.size()==3)
|
if (m_points_of_face.size()==3)
|
||||||
{ triangular_face_end_internal(normal); } // Triangle: no need to triangulate
|
{ triangular_face_end_internal(normal); } // Triangle: no need to triangulate
|
||||||
/*
|
|
||||||
// TODO BUG FIX HERE
|
|
||||||
else if (is_current_face_convex(normal))
|
else if (is_current_face_convex(normal))
|
||||||
{
|
{
|
||||||
if (m_points_of_face.size()==4)
|
if (m_points_of_face.size()==4)
|
||||||
{ convex_quadrangular_face_end_internal(normal); } // Convex quad
|
{ convex_quadrangular_face_end_internal(normal); } // Convex quad
|
||||||
else
|
else
|
||||||
{ convex_face_end_internal(normal); } // Convex face with > 4 vertices
|
{ convex_face_end_internal(normal); } // Convex face with > 4 vertices
|
||||||
} */
|
}
|
||||||
else
|
else
|
||||||
{ // Non convex and more than 3 points: we triangulate
|
{ // Non convex and more than 3 points: we triangulate
|
||||||
nonconvex_face_end_internal(normal);
|
nonconvex_face_end_internal(normal);
|
||||||
|
|
@ -421,15 +419,15 @@ public:
|
||||||
static bool is_facet_convex(const std::vector<Local_point>& facet,
|
static bool is_facet_convex(const std::vector<Local_point>& facet,
|
||||||
const Local_vector& normal)
|
const Local_vector& normal)
|
||||||
{
|
{
|
||||||
Local_kernel::Orientation orientation;
|
Local_kernel::Orientation orientation, local_orientation;
|
||||||
std::size_t id=0;
|
std::size_t id=0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const Local_point& S=facet[id];
|
const Local_point& S=facet[id];
|
||||||
const Local_point& T=facet[id+1];
|
const Local_point& T=facet[(id+1==facet.size())?0:id+1];
|
||||||
Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z());
|
Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z());
|
||||||
|
|
||||||
const Local_point& U=facet[id+2];
|
const Local_point& U=facet[(id+2==facet.size())?0:id+2];
|
||||||
Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z());
|
Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z());
|
||||||
|
|
||||||
orientation = Local_kernel::Orientation_3()(V1, V2, normal);
|
orientation = Local_kernel::Orientation_3()(V1, V2, normal);
|
||||||
|
|
@ -440,24 +438,22 @@ public:
|
||||||
|
|
||||||
//Here, all orientations were COPLANAR. Not sure this case is possible,
|
//Here, all orientations were COPLANAR. Not sure this case is possible,
|
||||||
// but we stop here.
|
// but we stop here.
|
||||||
if (orientation==CGAL::COPLANAR)
|
if (orientation==CGAL::COPLANAR || orientation==CGAL::ZERO)
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
// Now we compute convexness
|
// Now we compute convexness
|
||||||
for(id=0; id<facet.size(); ++id)
|
for(id=0; id<facet.size(); ++id)
|
||||||
{
|
{
|
||||||
const Local_point& S=facet[id];
|
const Local_point& S=facet[id];
|
||||||
const Local_point& T=facet[id+1];
|
const Local_point& T=facet[(id+1==facet.size())?0:id+1];
|
||||||
Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z());
|
Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z());
|
||||||
|
|
||||||
const Local_point& U=facet[id+2];
|
const Local_point& U=facet[(id+2==facet.size())?0:id+2];
|
||||||
Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z());
|
Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z());
|
||||||
|
|
||||||
orientation = Local_kernel::Orientation_3()(V1, V2, normal);
|
local_orientation=Local_kernel::Orientation_3()(V1, V2, normal) ;
|
||||||
|
|
||||||
Local_kernel::Orientation res=Local_kernel::Orientation_3()(V1, V2, normal) ;
|
if(local_orientation!=CGAL::ZERO && local_orientation!=orientation)
|
||||||
|
|
||||||
if(res!=CGAL::ZERO && res!=CGAL::COPLANAR && res!=orientation)
|
|
||||||
{ return false; }
|
{ return false; }
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue