Skip to content

Commit

Permalink
add checks in Triangulation
Browse files Browse the repository at this point in the history
  • Loading branch information
videlec committed Sep 27, 2024
1 parent 38bebc1 commit 772da41
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions veerer/triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ def relabel_homological_action(self, p, m, twist=False, check=True):
if is_e0_neg and not twist:
m[e] *= -1

def is_flippable(self, e):
def is_flippable(self, e, check=True):
r"""
Check whether the half-edge e is flippable.
Expand All @@ -1318,12 +1318,25 @@ def is_flippable(self, e):
False
sage: T.is_flippable(4)
True
A torus with boundary::
sage: t = Triangulation("(0,2,1)(3,~1,~0)", boundary="(~3:1,~2:1)")
sage: t.is_flippable(0)
True
sage: t.is_flippable(1)
True
sage: t.is_flippable(2)
False
sage: t.is_flippable(3)
False
"""
e = int(e)
if check:
e = self._check_half_edge(e)
E = self._ep[e]
a = self._fp[e]
b = self._fp[a]
return a != E and b != E and self._bdry[e] == 0 and self._bdry[E] == 0
return not self._bdry[e] and not self._bdry[E] and a != E and b != E and self._bdry[e] == 0 and self._bdry[E] == 0

def flippable_edges(self):
r"""
Expand Down Expand Up @@ -1380,7 +1393,7 @@ def square_about_edge(self, e, check=True):
e = self._check_half_edge(e)

E = self._ep[e]
if self._bdry[e] or self._bdry[E]:
if check and (self._bdry[e] or self._bdry[E]):
raise ValueError('non internal edge')

a = self._fp[e]
Expand Down

0 comments on commit 772da41

Please sign in to comment.