Skip to content

Commit

Permalink
Rename 'QuadEdge' class method: 'orientation_with' -> 'orientation_of'
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed Jan 26, 2021
1 parent 9ed7b8d commit 54788bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions sect/core/delaunay/quad_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def disconnect(self) -> None:
self.splice(self.right_from_start)
self.opposite.splice(self.opposite.right_from_start)

def orientation_with(self, point: Point) -> Orientation:
def orientation_of(self, point: Point) -> Orientation:
return orientation(self.end, self._start, point)


Expand All @@ -195,10 +195,10 @@ def edge_to_non_adjacent_vertices(edge: QuadEdge) -> Set[Point]:


def _edge_to_incidents(edge: QuadEdge) -> Iterable[QuadEdge]:
if (edge.orientation_with(edge.right_from_start.end)
if (edge.orientation_of(edge.right_from_start.end)
is Orientation.CLOCKWISE):
yield edge.right_from_start
if (edge.orientation_with(edge.left_from_start.end)
if (edge.orientation_of(edge.left_from_start.end)
is Orientation.COUNTERCLOCKWISE):
yield edge.left_from_start

Expand Down
14 changes: 7 additions & 7 deletions sect/core/delaunay/triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _triangles(self) -> Iterable[Triangle]:
visited_vertices = set(self._triangular_holes_vertices)
for edge in self.edges():
if (edge.left_from_start.end == edge.opposite.right_from_start.end
and (edge.orientation_with(edge.left_from_start.end)
and (edge.orientation_of(edge.left_from_start.end)
is Orientation.COUNTERCLOCKWISE)):
triangle = edge.start, edge.end, edge.left_from_start.end
vertices = frozenset(triangle)
Expand All @@ -138,10 +138,10 @@ def _merge_with(self, other: 'Triangulation') -> 'Triangulation':

def _find_base_edge(self, other: 'Triangulation') -> QuadEdge:
while True:
if (self.right_edge.orientation_with(other.left_edge.start)
if (self.right_edge.orientation_of(other.left_edge.start)
is Orientation.COUNTERCLOCKWISE):
self.right_edge = self.right_edge.left_from_end
elif (other.left_edge.orientation_with(self.right_edge.start)
elif (other.left_edge.orientation_of(self.right_edge.start)
is Orientation.CLOCKWISE):
other.left_edge = other.left_edge.right_from_end
else:
Expand Down Expand Up @@ -301,11 +301,11 @@ def _merge(base_edge: QuadEdge) -> None:

def _to_left_candidate(base_edge: QuadEdge) -> Optional[QuadEdge]:
result = base_edge.opposite.left_from_start
if base_edge.orientation_with(result.end) is not Orientation.CLOCKWISE:
if base_edge.orientation_of(result.end) is not Orientation.CLOCKWISE:
return None
while (is_point_inside_circumcircle(base_edge.end, base_edge.start,
result.end, result.left_from_start.end)
and (base_edge.orientation_with(result.left_from_start.end)
and (base_edge.orientation_of(result.left_from_start.end)
is Orientation.CLOCKWISE)):
next_candidate = result.left_from_start
result.disconnect()
Expand All @@ -315,12 +315,12 @@ def _to_left_candidate(base_edge: QuadEdge) -> Optional[QuadEdge]:

def _to_right_candidate(base_edge: QuadEdge) -> Optional[QuadEdge]:
result = base_edge.right_from_start
if base_edge.orientation_with(result.end) is not Orientation.CLOCKWISE:
if base_edge.orientation_of(result.end) is not Orientation.CLOCKWISE:
return None
while (is_point_inside_circumcircle(base_edge.end, base_edge.start,
result.end,
result.right_from_start.end)
and (base_edge.orientation_with(result.right_from_start.end)
and (base_edge.orientation_of(result.right_from_start.end)
is Orientation.CLOCKWISE)):
next_candidate = result.right_from_start
result.disconnect()
Expand Down

0 comments on commit 54788bb

Please sign in to comment.