diff --git a/point.py b/point.py index 9e23b56..011178a 100644 --- a/point.py +++ b/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()) @@ -26,17 +37,6 @@ class Point(QtCore.QPoint): __rsub__ = __sub__ __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())