Skip to content

Commit

Permalink
Cusp cross section: intializing first edge with number of correct type.
Browse files Browse the repository at this point in the history
  • Loading branch information
unhyperbolic committed Jul 19, 2023
1 parent 3342cf8 commit f1d5de4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
19 changes: 14 additions & 5 deletions python/snap/cusp_cross_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,16 @@ class RealHoroTriangle:
The sides of the triangle correspond to faces of the tetrahedron.
The lengths stored for the triangle are real.
"""
def __init__(self, tet, vertex, known_side, length_of_side):
def __init__(self, tet, vertex, known_side, length_of_side=None):
left_side, center_side, right_side, z_left, z_right = (
HoroTriangleBase._sides_and_cross_ratios(tet, vertex, known_side))

L = length_of_side
if length_of_side is None:
RF = z_left.real().parent()
L = RF(1)
else:
L = length_of_side

self.lengths = { center_side : L,
left_side : abs(z_left) * L,
right_side : L / abs(z_right) }
Expand Down Expand Up @@ -165,11 +170,15 @@ class ComplexHoroTriangle:
The sides of the triangle correspond to faces of the tetrahedron.
The lengths stored for the triangle are complex.
"""
def __init__(self, tet, vertex, known_side, length_of_side):
def __init__(self, tet, vertex, known_side, length_of_side=None):
left_side, center_side, right_side, z_left, z_right = (
HoroTriangleBase._sides_and_cross_ratios(tet, vertex, known_side))

L = length_of_side
if length_of_side is None:
CF = z_left.parent()
L = CF(1)
else:
L = length_of_side
self.lengths = { center_side : L,
left_side : - z_left * L,
right_side : - L / z_right }
Expand Down Expand Up @@ -306,7 +315,7 @@ def _add_one_cusp_cross_section(self, cusp, one_cocycle):
corner0 = cusp.Corners[0]
tet0, vert0 = corner0.Tetrahedron, corner0.Subsimplex
face0 = simplex.FacesAroundVertexCounterclockwise[vert0][0]
tet0.horotriangles[vert0] = self.HoroTriangle(tet0, vert0, face0, 1)
tet0.horotriangles[vert0] = self.HoroTriangle(tet0, vert0, face0)
active = [(tet0, vert0)]
while active:
tet0, vert0 = active.pop()
Expand Down
3 changes: 3 additions & 0 deletions python/verify/squareExtensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ def __init__(self, value=None, d={}, embed_cache=None):
# Set embed cache, see _get_interval_embedding_from_cache for details
self._embed_cache = embed_cache

def parent(self):
return SqrtLinCombination

def __add__(self, other):
# Try to convert other term to SqrtLinCombination if necessary
if not isinstance(other, SqrtLinCombination):
Expand Down

0 comments on commit f1d5de4

Please sign in to comment.