Skip to content

Instantly share code, notes, and snippets.

@winniehell
Created November 4, 2012 19:56
Show Gist options
  • Save winniehell/4013377 to your computer and use it in GitHub Desktop.
Save winniehell/4013377 to your computer and use it in GitHub Desktop.
Test code for CGAL bindings of the Sweep_line_2 module
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]))
@winniehell
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment