Skip to content

Commit

Permalink
Complete imports for 'planar' module
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed Dec 18, 2020
1 parent 3b6bbce commit 4aacc4e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions bentley_ottmann/planar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ground.linear import (SegmentsRelationship as _SegmentsRelationship,
to_segments_intersector as _to_segments_intersector)

from .core import planar as _planar
from .core.planar import sweep as _sweep
from .core.utils import (merge_ids as _merge_ids,
to_pairs_combinations as _to_pairs_combinations)

Expand Down Expand Up @@ -78,7 +78,7 @@ def non_neighbours_intersect(edges_ids: Iterable[Tuple[int, int]],
or second_event.relationship is _SegmentsRelationship.OVERLAP
or non_neighbours_intersect(_to_pairs_combinations(_merge_ids(
first_event.segments_ids, second_event.segments_ids))))
for first_event, second_event in _planar.sweep(edges, False))
for first_event, second_event in _sweep(edges, False))


def _all_unique(values: Iterable[Hashable]) -> bool:
Expand Down Expand Up @@ -131,7 +131,7 @@ def segments_intersect(segments: Sequence[Segment],
... Segment(Point(2, 0), Point(0, 2))])
True
"""
return any(_planar.sweep(segments, validate))
return any(_sweep(segments, validate))


def segments_cross_or_overlap(segments: Sequence[Segment],
Expand Down Expand Up @@ -176,8 +176,7 @@ def segments_cross_or_overlap(segments: Sequence[Segment],
relationships = _SegmentsRelationship.CROSS, _SegmentsRelationship.OVERLAP
return any(first_event.relationship in relationships
or second_event.relationship in relationships
for first_event, second_event in _planar.sweep(segments,
validate))
for first_event, second_event in _sweep(segments, validate))


def segments_intersections(segments: Sequence[Segment],
Expand Down Expand Up @@ -226,7 +225,7 @@ def segments_intersections(segments: Sequence[Segment],
"""
result = {}
segments_intersector = _to_segments_intersector()
for first_event, second_event in _planar.sweep(segments, validate):
for first_event, second_event in _sweep(segments, validate):
for segment_id, next_segment_id in _to_pairs_combinations(_merge_ids(
first_event.segments_ids, second_event.segments_ids)):
segment, next_segment = (segments[segment_id],
Expand Down

0 comments on commit 4aacc4e

Please sign in to comment.