8000 Added negative sign and compute sin and cos once · matplotlib/matplotlib@a99c3ec · GitHub
[go: up one dir, main page]

Skip to content

Commit a99c3ec

Browse files
eindHeindH
authored and
eindH
committed
Added negative sign and compute sin and cos once
1 parent 760267b commit a99c3ec

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,15 @@ def _calculate_quad_point_coordinates(x, y, width, height, angle=0):
256256
rectangle when rotated by angle around x, y
257257
"""
258258

259-
angle = math.radians(angle)
260-
a = x + height * math.sin(angle)
261-
b = y + height * math.cos(angle)
262-
c = x + width * math.cos(angle) + height * math.sin(angle)
263-
d = y - width * math.sin(angle) + height * math.cos(angle)
264-
e = x + width * math.cos(angle)
265-
f = y - width * math.sin(angle)
259+
angle = math.radians(-angle)
260+
sin_angle = math.sin(angle)
261+
cos_angle = math.cos(angle)
262+
a = x + height * sin_angle
263+
b = y + height * cos_angle
264+
c = x + width * cos_angle + height * sin_angle
265+
d = y - width * sin_angle + height * cos_angle
266+
e = x + width * cos_angle
267+
f = y - width * sin_angle
266268
return ((x, y), (a, b), (c, d), (e, f))
267269

268270

0 commit comments

Comments
 (0)
0