def perpendicular_angle(parallel: Parallel, finder: Finder) -> None:
    line1 = finder.extend_line(parallel.line1)
    line2 = finder.extend_line(parallel.line2)
    link1 = finder.find_link_by_ends(*line1.ends)
    link2 = finder.find_link_by_ends(*line2.ends)
    col1 = Collineation('Collineation ' + line1.id, points=link1)
    col2 = Collineation('Collineation ' + line2.id, points=link2)

    for angle1, angle2 in _find_alternate_angels(col1, col2, finder):
        yield symbol(angle1, 'angle') - symbol(angle2, 'angle')
Exemplo n.º 2
0
def perpendicular_angle(perpendicular: Perpendicular,
                       finder: Finder) -> None:
    line1 = perpendicular.line1
    line2 = perpendicular.line2
    # Extend line first.
    line1 = finder.extend_line(line1)
    line2 = finder.extend_line(line2)
    # Find intersection.
    intersection = finder.find_lines_intersection(line1, line2)
    if len(intersection) != 1:
        raise Exception('Perpendicular relationship is suppposed to include '
                        'two perpendicular line. Except 1, got {}.'
                        .format(len(intersection)))
    cross_p = intersection[0]
    for p1 in line1.ends:
        for p2 in line2.ends:
            if p1 == cross_p or p2 == cross_p:
                continue
            line1_ = finder.find_line_by_ends(p1, cross_p)
            line2_ = finder.find_line_by_ends(p2, cross_p)
            angle = finder.find_angle_by_sides(line1_, line2_)
            yield symbol(angle, 'angle') - 90