Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,25 @@ def _calculate_quad_point_coordinates(x, y, width, height, angle=0):
Calculate the coordinates of rectangle when rotated by angle around x, y
"""

angle = math.radians(-angle)
sin_angle = math.sin(angle)
cos_angle = math.cos(angle)
a = x + height * sin_angle
b = y + height * cos_angle
c = x + width * cos_angle + height * sin_angle
d = y - width * sin_angle + height * cos_angle
e = x + width * cos_angle
f = y - width * sin_angle
if angle:
angle = math.radians(-angle)
sin_angle = math.sin(angle)
cos_angle = math.cos(angle)
else:
sin_angle = 0.0
cos_angle = 1.0

height_sin = height * sin_angle
height_cos = height * cos_angle
width_cos = width * cos_angle
width_sin = width * sin_angle

a = x + height_sin
b = y + height_cos
c = x + width_cos + height_sin
d = y - width_sin + height_cos
e = x + width_cos
f = y - width_sin
return ((x, y), (e, f), (c, d), (a, b))


Expand Down