move rotate to top
This commit is contained in:
parent
05f282f698
commit
9d0f2392ca
22
point.py
22
point.py
@ -10,6 +10,17 @@ class Point(QtCore.QPoint):
|
||||
Point of coordinates (x, y)
|
||||
"""
|
||||
|
||||
def rotate(self, center, direction=CLOCKWISE):
|
||||
""" Returns the Point image of the rotation of self
|
||||
through 90° CLOKWISE or COUNTERCLOCKWISE around center"""
|
||||
if self == center:
|
||||
return self
|
||||
|
||||
p = self - center
|
||||
p = Point(-direction * p.y(), direction * p.x())
|
||||
p += center
|
||||
return p
|
||||
|
||||
def __add__(self, o):
|
||||
return Point(self.x() + o.x(), self.y() + o.y())
|
||||
|
||||
@ -27,17 +38,6 @@ class Point(QtCore.QPoint):
|
||||
__rmul__ = __mul__
|
||||
__rtruediv__ = __truediv__
|
||||
|
||||
def rotate(self, center, direction=CLOCKWISE):
|
||||
""" Returns the Point image of the rotation of self
|
||||
through 90° CLOKWISE or COUNTERCLOCKWISE around center"""
|
||||
if self == center:
|
||||
return self
|
||||
|
||||
p = self - center
|
||||
p = Point(-direction * p.y(), direction * p.x())
|
||||
p += center
|
||||
return p
|
||||
|
||||
def __repr__(self):
|
||||
return "Point({}, {})".format(self.x(), self.y())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user