import math

import core


class FanMainDrawer:
    def __init__(self, msp, gap, center, route):
        self.msp = msp
        self.gap = gap
        self.center = center
        self.route = route

    def draw_fan_main(self):
        rad = 3 / 10 * self.gap
        a = math.pi / 8
        b = 10 / 3 * rad

        self.msp.add_circle(center=self.center, radius=rad)

        A = (rad * math.cos(a) + self.center[0], rad * math.sin(a) + self.center[1])

        C = (rad * math.cos(a) + self.center[0], -rad * math.sin(a) + self.center[1])

        B = ((b / 2) / math.tan(a) + self.center[0], (b / 2) + self.center[1])

        D = ((b / 2) / math.tan(a) + self.center[0], -(b / 2) + self.center[1])

        A = core.rotate_point_around_another(A, self.center, self.route)
        B = core.rotate_point_around_another(B, self.center, self.route)
        C = core.rotate_point_around_another(C, self.center, self.route)
        D = core.rotate_point_around_another(D, self.center, self.route)

        self.msp.add_line(A, B)

        self.msp.add_line(B, D)

        self.msp.add_line(C, D)
