FanMainDrawer.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import math
  2. import core
  3. class FanMainDrawer:
  4. def __init__(self, msp, gap, center, route):
  5. self.msp = msp
  6. self.gap = gap
  7. self.center = center
  8. self.route = route
  9. def draw_fan_main(self):
  10. rad = 3 / 10 * self.gap
  11. a = math.pi / 8
  12. b = 10 / 3 * rad
  13. self.msp.add_circle(center=self.center, radius=rad)
  14. A = (rad * math.cos(a) + self.center[0], rad * math.sin(a) + self.center[1])
  15. C = (rad * math.cos(a) + self.center[0], -rad * math.sin(a) + self.center[1])
  16. B = ((b / 2) / math.tan(a) + self.center[0], (b / 2) + self.center[1])
  17. D = ((b / 2) / math.tan(a) + self.center[0], -(b / 2) + self.center[1])
  18. A = core.rotate_point_around_another(A, self.center, self.route)
  19. B = core.rotate_point_around_another(B, self.center, self.route)
  20. C = core.rotate_point_around_another(C, self.center, self.route)
  21. D = core.rotate_point_around_another(D, self.center, self.route)
  22. self.msp.add_line(A, B)
  23. self.msp.add_line(B, D)
  24. self.msp.add_line(C, D)