def rotate(self, angle=0, pt=None): """Rotate ``angle`` radians counterclockwise about Point ``pt``. The default pt is the origin, Point(0, 0). Examples ======== >>> from sympy.geometry.curve import Curve >>> from sympy.abc import x >>> from sympy import pi >>> Curve((x, x), (x, 0, 1)).rotate(pi/2) Curve((-x, x), (x, 0, 1)) """ from sympy.matrices import Matrix, rot_axis3 pt = -Point(pt or (0, 0)) rv = self.translate(*pt.args) f = list(rv.functions) f.append(0) f = Matrix(1, 3, f) f *= rot_axis3(angle) rv = self.func(f[0, :2].tolist()[0], self.limits) if pt is not None: pt = -pt return rv.translate(*pt.args) return rv
def rotate(self, angle=0, pt=None): """This function is used to rotate a curve along given point ``pt`` at given angle(in radian). Parameters ========== angle : the angle at which the curve will be rotated(in radian) in counterclockwise direction. default value of angle is 0. pt : Point the point along which the curve will be rotated. If no point given, the curve will be rotated around origin. Returns ======= Curve : returns a curve rotated at given angle along given point. Examples ======== >>> from sympy.geometry.curve import Curve >>> from sympy.abc import x >>> from sympy import pi >>> Curve((x, x), (x, 0, 1)).rotate(pi/2) Curve((-x, x), (x, 0, 1)) """ from sympy.matrices import Matrix, rot_axis3 if pt: pt = -Point(pt, dim=2) else: pt = Point(0, 0) rv = self.translate(*pt.args) f = list(rv.functions) f.append(0) f = Matrix(1, 3, f) f *= rot_axis3(angle) rv = self.func(f[0, :2].tolist()[0], self.limits) if pt is not None: pt = -pt return rv.translate(*pt.args) return rv