#極座標(r, Θ)から直交座標(x, y)を求める
def getXY(r, degree):
# 度をラジアンに変換
rad = math.radians(degree)
x = r * math.cos(rad)
y = r * math.sin(rad)
print(x, y)
return x, y
#直交座標(x, y)から極座標(r, Θ)を求める
def getRD(x, y):
r = math.sqrt(x**2+y**2)
rad = math.atan2(y, x)
degree = math.degrees(rad)
print(r, degree)
return r, degree
#原点xyから特定のXYへの極座標(r, Θ)を求める
def getxy_RD(x, y, X, Y):
_x, _y = (X-x), (Y-y)
r = math.sqrt(_x**2+_y**2)
rad = math.atan2(_y, _x)
degree = math.degrees(rad)
print(r, degree)
return r, degree