diff --git a/python/snap/cusp_cross_section.py b/python/snap/cusp_cross_section.py index e406020d9..0152f6c8d 100644 --- a/python/snap/cusp_cross_section.py +++ b/python/snap/cusp_cross_section.py @@ -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) } @@ -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 } @@ -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() diff --git a/python/verify/squareExtensions.py b/python/verify/squareExtensions.py index 603b21daa..5b43f1919 100644 --- a/python/verify/squareExtensions.py +++ b/python/verify/squareExtensions.py @@ -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):