📜  Python| Sympy Ellipse.rotate() 方法

📅  最后修改于: 2022-05-13 01:55:12.866000             🧑  作者: Mango

Python| Sympy Ellipse.rotate() 方法

在 Sympy 中,函数rotate()用于将椭圆围绕给定点逆时针旋转给定角度。
Syntax: Ellipse.rotate(angle=0, pt=None)

Parameters:
angle: in radian
pt: point about which ellipse is rotated in counterclockwise.

Returns: rotated ellipse

示例 #1:

# import sympy and pi, Ellipse
from sympy import Ellipse, pi
  
# using Ellipse() method
e1 = Ellipse((1, 0), 2, 1)
  
# using rotate() method
e1.rotate(pi / 2)
  
print(e1)

输出:

Ellipse(Point2D(0, 1), 1, 2)

示例 #2:

# import sympy and pi, Ellipse
from sympy import Ellipse, pi
  
# using Ellipse() method
e2 = Ellipse((1, 0), 2, 1)
  
# using rotate() with given point method
e2.rotate(pi / 2, (1, 2))
  
print(e2)

输出:

Ellipse(Point2D(3, 2), 1, 2)