add fast-path for 0-degree rotations
This commit is contained in:
parent
0fa073b488
commit
d4fbdd8d27
@ -314,7 +314,8 @@ class Path(Shape):
|
|||||||
return bounds
|
return bounds
|
||||||
|
|
||||||
def rotate(self, theta: float) -> 'Path':
|
def rotate(self, theta: float) -> 'Path':
|
||||||
self.vertices = numpy.dot(rotation_matrix_2d(theta), self.vertices.T).T
|
if theta != 0:
|
||||||
|
self.vertices = numpy.dot(rotation_matrix_2d(theta), self.vertices.T).T
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def mirror(self, axis: int) -> 'Path':
|
def mirror(self, axis: int) -> 'Path':
|
||||||
|
@ -262,7 +262,8 @@ class Polygon(Shape):
|
|||||||
self.offset + numpy.max(self.vertices, axis=0)))
|
self.offset + numpy.max(self.vertices, axis=0)))
|
||||||
|
|
||||||
def rotate(self, theta: float) -> 'Polygon':
|
def rotate(self, theta: float) -> 'Polygon':
|
||||||
self.vertices = numpy.dot(rotation_matrix_2d(theta), self.vertices.T).T
|
if theta != 0:
|
||||||
|
self.vertices = numpy.dot(rotation_matrix_2d(theta), self.vertices.T).T
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def mirror(self, axis: int) -> 'Polygon':
|
def mirror(self, axis: int) -> 'Polygon':
|
||||||
|
Loading…
Reference in New Issue
Block a user