'Is another triangle similar to this one.
Two triangles are similar if one can be uniformly scaled to the other.
Parameters
other: Triangle
Returns
is_similar : boolean
See Also
sympy.geometry.entity.GeometryEntity.is_similar
Examples
>>> from sympy.geometry import Triangle, Point
>>> t1 = Triangle(Point(0, 0), Point(4, 0), Point(4, 3))
>>> t2 = Triangle(Point(0, 0), Point(-4, 0), Point(-4, -3))
>>> t1.is_similar(t2)
True
>>> t2 = Triangle(Point(0, 0), Point(-4, 0), Point(-4, -4))
>>> t1.is_similar(t2)
False'

def is_similar(t1, t2):

    if (not isinstance(t2, Polygon)):
        return False
    (s1_1, s1_2, s1_3) = [side.length for side in t1.sides]
    s2 = [side.length for side in t2.sides]
    def _are_similar(u1, u2, u3, v1, v2, v3):
        e1 = simplify((u1 / v1))
        e2 = simplify((u2 / v2))
        e3 = simplify((u3 / v3))
        return (bool((e1 == e2)) and bool((e2 == e3)))
    return (_are_similar(s1_1, s1_2, s1_3, *s2) or _are_similar(s1_1, s1_3, s1_2, *s2) or _are_similar(s1_2, s1_1, s1_3, *s2) or _are_similar(s1_2, s1_3, s1_1, *s2) or _are_similar(s1_3, s1_1, s1_2, *s2) or _are_similar(s1_3, s1_2, s1_1, *s2))
