Example #1
0
def IsCenterOf(point, twod):
    name = twod.__class__.__name__
    if name == 'circle':
        return Equals(point[0], twod.center[0]) & Equals(point[1], twod.center[1])
    elif issubtype(name, 'polygon'):
        distances = [distance_between_points(point, each) for each in twod]
        reg = IsRegular(twod)
        out = reduce(operator.__and__, (Equals(distances[index-1], distance) for index, distance in enumerate(distances)), True)
        return reg & out
    else:
        raise Exception()
Example #2
0
def IsRectLengthOf(number, quad):
    l1 = distance_between_points(quad[0], quad[1])
    l2 = distance_between_points(quad[1], quad[2])
    return Equals(l1, number) | Equals(l2, number)
Example #3
0
def Isosceles(triangle):
    sides = [distance_between_points(triangle[index-1], point) for index, point in enumerate(triangle)]
    combs = itertools.combinations(sides, 2)

    out = reduce(operator.__or__, (Equals(a, b) for a, b in combs), False)
    return out
Example #4
0
def Colinear(A, B, C):
    line = instantiators['line'](A, C)
    eq = Equals(LengthOf(line), distance_between_points(line.a, B) + distance_between_points(line.b, B))
    return eq
Example #5
0
def PointLiesOnCircle(point, circle):
    d = distance_between_points(point, circle.center)
    return Equals(d, circle.radius)