add fast-path for 0-degree rotations

This commit is contained in:
Jan Petykiewicz 2020-08-11 01:17:23 -07:00
parent 0fa073b488
commit d4fbdd8d27
2 changed files with 4 additions and 2 deletions

View File

@ -314,6 +314,7 @@ class Path(Shape):
return bounds
def rotate(self, theta: float) -> 'Path':
if theta != 0:
self.vertices = numpy.dot(rotation_matrix_2d(theta), self.vertices.T).T
return self

View File

@ -262,6 +262,7 @@ class Polygon(Shape):
self.offset + numpy.max(self.vertices, axis=0)))
def rotate(self, theta: float) -> 'Polygon':
if theta != 0:
self.vertices = numpy.dot(rotation_matrix_2d(theta), self.vertices.T).T
return self