1
0
Fork 0
NotesUESTC/vslam/数学推导.md

864 B

数学基础

1、从点到面的距离推导

求三维空间内点p(x_p,y_p,z_p)到平面Ax+By+Cz+D的距离。

很容易知道,平面方程Ax+By+Cz+D=0的法向量是\vec n = (A,B,C)。对于过空间点p且方向向量为\vec n的直线为:


\frac{x-x_P}{A}=\frac{y-y_p}{B}=\frac{z-z_p}{C}

联立方程组:


\frac{x-x_P}{A}=\frac{y-y_p}{B}=\frac{z-z_p}{C} \\
Ax+By+Cz+D=0

假设三维直线和三维平面的交点为(x_0,y_0,z_0)


\frac{x_0-x_P}{A}=\frac{y_0-y_p}{B} \\
\frac{y_0-y_p}{B}=\frac{z_0-z_p}{C} \\
Ax_0+By_0+Cz_0+D_0=0

那么根据距离公式:


d=\sqrt{(x_0-x_p)^2+(y_0-y_p)^2+(z_0-z_p)^2}\\
d=\sqrt{(\frac{A}{B})^2\cdot(y_0-y_p)^2+(y_0-y_p)^2+(\frac{C}{B})^2\cdot(y_0-y_p)^2}\\
d^2=\frac{A^2\cdot(y_0-y_p)^2}{B^2}+(y_0-y_p)^2+\frac{C^2}{B^2}\cdot(y_0-y_p)^2
=\frac{(A^2+B^2+C^2)}{B^2}\cdot(y_0-y_p)^2