Return the distance from the given points to the boundaries of a rotated box, in pixels.
(self, rotation, x0, y0, figure_box)
| 753 | return line_width |
| 754 | |
| 755 | def _get_dist_to_box(self, rotation, x0, y0, figure_box): |
| 756 | """ |
| 757 | Return the distance from the given points to the boundaries of a |
| 758 | rotated box, in pixels. |
| 759 | """ |
| 760 | if rotation > 270: |
| 761 | quad = rotation - 270 |
| 762 | h1 = (y0 - figure_box.y0) / math.cos(math.radians(quad)) |
| 763 | h2 = (figure_box.x1 - x0) / math.cos(math.radians(90 - quad)) |
| 764 | elif rotation > 180: |
| 765 | quad = rotation - 180 |
| 766 | h1 = (x0 - figure_box.x0) / math.cos(math.radians(quad)) |
| 767 | h2 = (y0 - figure_box.y0) / math.cos(math.radians(90 - quad)) |
| 768 | elif rotation > 90: |
| 769 | quad = rotation - 90 |
| 770 | h1 = (figure_box.y1 - y0) / math.cos(math.radians(quad)) |
| 771 | h2 = (x0 - figure_box.x0) / math.cos(math.radians(90 - quad)) |
| 772 | else: |
| 773 | h1 = (figure_box.x1 - x0) / math.cos(math.radians(rotation)) |
| 774 | h2 = (figure_box.y1 - y0) / math.cos(math.radians(90 - rotation)) |
| 775 | |
| 776 | return min(h1, h2) |
| 777 | |
| 778 | def _get_rendered_text_width(self, text): |
| 779 | """ |
no outgoing calls
no test coverage detected