Created
November 8, 2010 17:22
-
-
Save liesen/667960 to your computer and use it in GitHub Desktop.
CGAL bugs: Sweep line algorithm does not respect the report_endpoints argument
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- CGAL/Sweep_line_2/Sweep_line_2_visitors.h 2010-11-08 18:45:53.000000000 +0100 | |
+++ /Users/liesen/crap/Sweep_line_2_visitors.h 2010-11-08 18:45:45.000000000 +0100 | |
@@ -99,9 +99,7 @@ | |
Status_line_iterator /* iter */, | |
bool /* flag */) | |
{ | |
- if ((m_includeEndPoints || | |
- event->is_intersection() || | |
- event->is_weak_intersection()) && event->is_closed()) | |
+ if ((event->is_intersection() || (event->is_weak_intersection() && m_includeEndPoints)) && event->is_closed()) | |
{ | |
*m_out = event->point(); | |
++m_out; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CGAL/Arr_segment_traits_2.h> | |
#include <CGAL/Cartesian.h> | |
#include <CGAL/Gmpq.h> | |
#include <CGAL/Simple_cartesian.h> | |
#include <CGAL/Sweep_line_2_algorithms.h> | |
#include <list> | |
#include <set> | |
typedef CGAL::Gmpq NT; | |
typedef CGAL::Simple_cartesian<NT> Kernel; | |
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2; | |
typedef Traits_2::Curve_2 Segment_2; | |
typedef Traits_2::Point_2 Point_2; | |
int main() { | |
const int kNumSegments = 2; | |
Segment_2 segments[kNumSegments] = { | |
Segment_2(Point_2(-2, 2), Point_2(2, -2)), | |
Segment_2(Point_2(-2, -2), Point_2(0, 0)) | |
}; | |
std::set<Point_2> intersection_points; | |
CGAL::compute_intersection_points( | |
segments, | |
segments + kNumSegments, | |
std::inserter(intersection_points, intersection_points.end()), | |
/* report_endpoints */ false); | |
std::copy(intersection_points.begin(), intersection_points.end(), | |
std::ostream_iterator<Point_2>(std::cout, "\n")); | |
assert(intersection_points.size() == 0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment