如图所示,极坐标系中,每一个点M,都可以用其距离原点O的距离
ρ
rho
ρ和OM与x轴的夹角
θ
theta
θ唯一确定。M的极坐标为
(
ρ
,
θ
)
(rho,theta)
(ρ,θ),其中
θ
theta
θ为极角。
设M点在直角坐标系中的坐标为
(
x
,
y
)
(x,y)
(x,y),原点O的坐标为
(
0
,
0
)
(0,0)
(0,0),则与极坐标存在如下等式关系:
{
ρ
=
x
2
+
y
2
tan
(
θ
)
=
y
x
(
x
≠
0
)
begin{cases} rho = x^2 + y ^ 2 \ tan(theta) = frac y x (x neq 0)end{cases}
{ρ=x2+y2tan(θ)=xy(x=0)或
{
x
=
ρ
cos
(
θ
)
y
=
ρ
sin
(
θ
)
begin{cases} x = rho cos(theta) \ y = rho sin(theta) end{cases}
{x=ρcos(θ)y=ρsin(θ)
所以,极角
θ
=
arctan
(
y
x
)
theta=arctan(frac y x)
θ=arctan(xy)
使用java.lang.Math的atan2函数,对于点M ( x , y ) (x,y) (x,y),其与原点O ( 0 , 0 ) (0,0) (0,0)的极角 θ = M a t h . a t a n 2 ( y , x ) theta = Math.atan2(y, x) θ=Math.atan2(y,x)
public static double atan2(double y, double x)
如果O的坐标为 ( x 0 , y 0 ) (x_0,y_0) (x0,y0),点M ( x , y ) (x,y) (x,y)与O的极角为 θ = M a t h . a t a n 2 ( y − y 0 , x − x 0 ) theta = Math.atan2(y-y_0, x-x_0) θ=Math.atan2(y−y0,x−x0)



