给定点:
(x0,y0)
(x_0, y_0)
(x0,y0)
给定方向:
θ
\theta
θ
设直线方程为:
y=kx+b
y = kx + b
y=kx+b
则:
k=tanθ
k = tan\theta
k=tanθ
b=y0−x0tanθ
b = y_0 - x_0tan\theta
b=y0−x0tanθ
进而直线方程为:
y=tanθx+y0−x0tanθ
y = tan\theta x+ y_0 - x_0tan\theta
y=tanθx+y0−x0tanθ
考虑到θ=±π2\theta=\pm\frac{\pi}{2}θ=±2π时, k无意义,进而转换为:
cosθy=sinθx+cosθy0−x0sinθ
cos\theta y = sin\theta x + cos\theta y_0 - x_0 sin\theta
cosθy=sinθx+cosθy0−x0sinθ
转换为ax+by+c=0ax + by + c = 0ax+by+c=0的标准形式:
sinθx−cosθy+cosθy0−x0sinθ=0
sin\theta x - cos\theta y + cos\theta y_0 - x_0sin\theta = 0
sinθx−cosθy+cosθy0−x0sinθ=0
05-16
6001
