Skip to content

Commit

Permalink
Complete formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed Jun 23, 2022
1 parent 2709fc4 commit 7e28df2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
6 changes: 4 additions & 2 deletions sect/core/delaunay/quad_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ def splice(self, other: 'QuadEdge') -> None:
alpha = self.left_from_start.rotated
beta = other.left_from_start.rotated
self._left_from_start, other._left_from_start = (
other.left_from_start, self.left_from_start)
other.left_from_start, self.left_from_start
)
alpha._left_from_start, beta._left_from_start = (
beta.left_from_start, alpha.left_from_start)
beta.left_from_start, alpha.left_from_start
)

def swap(self) -> None:
"""
Expand Down
15 changes: 9 additions & 6 deletions sect/core/delaunay/triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

from decision.partition import coin_change
from ground.base import (Context,
Location, Orientation,
Location,
Orientation,
Relation)
from ground.hints import (Contour,
Point,
Expand Down Expand Up @@ -98,7 +99,8 @@ def constrained_delaunay(cls,
border, holes = polygon.border, polygon.holes
if extra_points:
border, holes, extra_points = complete_vertices(
border, holes, extra_points, context)
border, holes, extra_points, context
)
result = cls.delaunay(list(chain(border.vertices,
flatten(hole.vertices
for hole in holes),
Expand All @@ -113,7 +115,8 @@ def constrained_delaunay(cls,
result._triangular_holes_vertices.update(
frozenset(hole.vertices)
for hole in holes
if len(hole.vertices) == 3)
if len(hole.vertices) == 3
)
return result

@classmethod
Expand All @@ -139,8 +142,7 @@ def delaunay(cls,
"""
points = sorted(to_distinct(points))
lengths = coin_change(len(points), base_cases)
result = [cls._initialize_triangulation(points[start:stop],
context)
result = [cls._initialize_triangulation(points[start:stop], context)
for start, stop in pairwise(accumulate((0,) + lengths))]
for _ in repeat(None, ceil_log2(len(result))):
parts_to_merge_count = len(result) // 2 * 2
Expand Down Expand Up @@ -213,7 +215,8 @@ def connect(base_edge: QuadEdge,
while True:
left_candidate, right_candidate = (
to_left_candidate(base_edge, point_in_circle_locator),
to_right_candidate(base_edge, point_in_circle_locator))
to_right_candidate(base_edge, point_in_circle_locator)
)
if left_candidate is right_candidate is None:
break
base_edge = (
Expand Down
9 changes: 6 additions & 3 deletions sect/core/delaunay/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def complete_vertices(border: Contour,
for hole in holes:
hole, candidates = _complete_contour_vertices(
hole, candidates, contour_cls, segment_cls,
segment_point_relater)
segment_point_relater
)
completed_holes.append(hole)
return border, completed_holes, candidates

Expand Down Expand Up @@ -93,7 +94,8 @@ def _complete_contour_vertices(contour: Contour,
candidate_index
for candidate_index in range(start_index, end_index)
if _is_inner_segment_point(start, end, candidates[candidate_index],
segment_cls, containment_checker)]
segment_cls, containment_checker)
]
if extra_vertices_indices:
extra_vertices[index] = [candidates[index]
for index in extra_vertices_indices]
Expand All @@ -111,7 +113,8 @@ def _complete_contour_vertices(contour: Contour,
else extra_vertices[index][::-1]) + [vertex]
if index in extra_vertices
else [vertex]
for index, vertex in enumerate(vertices))))
for index, vertex in enumerate(vertices)))
)
return contour, candidates


Expand Down

0 comments on commit 7e28df2

Please sign in to comment.