mirror of https://github.com/CGAL/cgal
add code to check and fix the input orientation
This commit is contained in:
parent
d024613501
commit
9193505df0
|
|
@ -37,6 +37,27 @@ int main( int argc, char* argv[] )
|
|||
{
|
||||
is >> input ;
|
||||
|
||||
//check the validity of the input and fix orientation
|
||||
if (!input.outer_boundary().is_simple())
|
||||
{
|
||||
std::cerr << "ERROR: outer boundary is not simple.";
|
||||
return 1;
|
||||
}
|
||||
if ( input.outer_boundary().is_clockwise_oriented() )
|
||||
input.outer_boundary().reverse_orientation();
|
||||
int k=0;
|
||||
for (Polygon_with_holes::Hole_iterator it = input.holes_begin();
|
||||
it!=input.holes_end(); ++it, ++k)
|
||||
{
|
||||
if (!it->is_simple())
|
||||
{
|
||||
std::cerr << "ERROR: hole "<< k << " is not simple.\n";
|
||||
return 1;
|
||||
}
|
||||
if (it->is_counterclockwise_oriented())
|
||||
it->reverse_orientation();
|
||||
}
|
||||
|
||||
Straight_skeleton_ptr ss = CGAL::create_interior_straight_skeleton_2(input);
|
||||
if ( ss )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue