add fast-path for 0-degree rotations
This commit is contained in:
		
							parent
							
								
									e1d890b44e
								
							
						
					
					
						commit
						c0f0b2190a
					
				| @ -317,7 +317,8 @@ class Path(Shape, metaclass=AutoSlots): | ||||
|         return bounds | ||||
| 
 | ||||
|     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 | ||||
| 
 | ||||
|     def mirror(self, axis: int) -> 'Path': | ||||
|  | ||||
| @ -266,7 +266,8 @@ class Polygon(Shape, metaclass=AutoSlots): | ||||
|                              self.offset + numpy.max(self.vertices, axis=0))) | ||||
| 
 | ||||
|     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 | ||||
| 
 | ||||
|     def mirror(self, axis: int) -> 'Polygon': | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user