diff --git a/Straight_skeleton_2/examples/Straight_skeleton_2/Show_straight_skeleton.cpp b/Straight_skeleton_2/examples/Straight_skeleton_2/Show_straight_skeleton.cpp index 143fc4bdae1..8a4aed5e198 100644 --- a/Straight_skeleton_2/examples/Straight_skeleton_2/Show_straight_skeleton.cpp +++ b/Straight_skeleton_2/examples/Straight_skeleton_2/Show_straight_skeleton.cpp @@ -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 ) {