Created
November 4, 2012 19:56
-
-
Save winniehell/4013377 to your computer and use it in GitHub Desktop.
Test code for CGAL bindings of the Sweep_line_2 module
This file contains hidden or 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
from CGAL.CGAL_Kernel import Point_2, Segment_2 | |
from CGAL.CGAL_Sweep_line_2 import \ | |
compute_intersection_points, \ | |
compute_subcurves, \ | |
do_curves_intersect,\ | |
test_segment_range | |
segments = [ | |
Segment_2(Point_2(0, 0), Point_2(10, 10)), | |
Segment_2(Point_2(10, 0), Point_2(0, 10)), | |
Segment_2(Point_2(5, 0), Point_2(5, 10)) | |
] | |
test_segment_range(segments) | |
print('intersect: %s' % do_curves_intersect(segments)) | |
points = [] | |
compute_intersection_points(segments, points, True) | |
print('intersection points: ' + ', '.join([str(p) for p in points])) | |
subsegments = [] | |
compute_subcurves(segments, subsegments, True) | |
print('subcurves: ' + ', '.join([str(segment) for segment in subsegments])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://github.com/winniehell/cgal-bindings-sweep-line