平面和射线交点

设平面 A x + B y + C z + D = 0 ( A 2 + B 2 + C 2 ≠ 0 ) Ax+By+Cz +D=0\left(A^2+B^2+C^2\neq 0\right) Ax+By+Cz+D=0(A2+B2+C2=0),

点 P ( P x , P y , P z ) P(P_x, P_y, P_z) P(Px,Py,Pz)

(1)求点 P P P到平面距离

(2)过点 P P P作直线,方向为 ( D x , D y , D z ) \left(D_x, D_y, D_z\right) (Dx,Dy,Dz),求平面与直线交点

(2)过点 P P P作射线,方向为 ( D x , D y , D z ) \left(D_x, D_y, D_z\right) (Dx,Dy,Dz),求平面与直线交点

解:

(1)这个高中有学过
∣ A P x + B P y + C P z + D ∣ A 2 + B 2 + C 2 \frac{\left|AP_x+BP_y+CP_z +D\right|}{\sqrt{A^2+B^2+C^2}} A2+B2+C2 ∣APx+BPy+CPz+D∣

(2)为了方便,平面法向量 n = ( A , B , C ) \mathbf{n} = \left(A,B,C\right) n=(A,B,C)

直线方向向量 d = ( D x , D y , D z ) \mathbf{d} = \left(D_x,D_y,D_z\right) d=(Dx,Dy,Dz)

直线上的点可以表示为 P + t d P+t\mathbf{d} P+td,其中 t ∈ R t\in \mathbb{R} t∈R

1.若 n ⋅ d ≠ 0 \mathbf{n}\cdot \mathbf{d}\neq 0 n⋅d=0,则直线和平面有且仅有1个交点

由于 P + t d P+t\mathbf{d} P+td在平面上,因此
n ⋅ ( P + t d ) + D = 0 ⇒ t = − D + n ⋅ P n ⋅ d \mathbf{n}\cdot\left(P+t\mathbf{d}\right) +D = 0\Rightarrow t= -\frac{D + \mathbf{n}\cdot P}{\mathbf{n}\cdot \mathbf{d}} n⋅(P+td)+D=0⇒t=−n⋅dD+n⋅P

进而交点坐标
P + t d = P − D + n ⋅ P n ⋅ d d = ( P x − ( A P x + B P y + C P z + D ) A D x + B D y + C D z D x P y − ( A P x + B P y + C P z + D ) A D x + B D y + C D z D y P z − ( A P x + B P y + C P z + D ) A D x + B D y + C D z D z ) \begin{aligned} P+t\mathbf{d} & = P -\frac{D + \mathbf{n}\cdot P}{\mathbf{n}\cdot \mathbf{d}}\mathbf{d}\\ &=\begin{pmatrix}P_x - \frac{\left(AP_x+BP_y +CP_z+D\right)}{AD_x +BD_y+CD_z}D_x\\ P_y - \frac{\left(AP_x+BP_y +CP_z+D\right)}{AD_x +BD_y+CD_z}D_y\\ P_z - \frac{\left(AP_x+BP_y +CP_z+D\right)}{AD_x +BD_y+CD_z}D_z\\ \end{pmatrix} \end{aligned} P+td=P−n⋅dD+n⋅Pd= Px−ADx+BDy+CDz(APx+BPy+CPz+D)DxPy−ADx+BDy+CDz(APx+BPy+CPz+D)DyPz−ADx+BDy+CDz(APx+BPy+CPz+D)Dz

2.若 n ⋅ d = 0 \mathbf{n}\cdot \mathbf{d}= 0 n⋅d=0,且 n ⋅ P + d = 0 \mathbf{n}\cdot P +d = 0 n⋅P+d=0,则直线与平面重合

3.若 n ⋅ d = 0 \mathbf{n}\cdot \mathbf{d}= 0 n⋅d=0,且 n ⋅ P + d ≠ 0 \mathbf{n}\cdot P +d \neq 0 n⋅P+d=0,则直线与平面无交点

(3)与(2)类似

射线上的点可以表示为 P + t d P+t\mathbf{d} P+td,其中 t ∈ R + t\in \mathbb{R}_{+} t∈R+

依然可以得到 t = − D + n ⋅ P n ⋅ d t= -\frac{D + \mathbf{n}\cdot P}{\mathbf{n}\cdot \mathbf{d}} t=−n⋅dD+n⋅P

1.若 n ⋅ d ≠ 0 \mathbf{n}\cdot \mathbf{d}\neq 0 n⋅d=0且 t < 0 t<0 t<0则无交点

2.若 n ⋅ d ≠ 0 \mathbf{n}\cdot \mathbf{d}\neq 0 n⋅d=0且 t ≥ 0 t\ge0 t≥0,则只有一个交点
P + t d = P − D + n ⋅ P n ⋅ d d = ( P x − ( A P x + B P y + C P z + D ) A D x + B D y + C D z D x P y − ( A P x + B P y + C P z + D ) A D x + B D y + C D z D y P z − ( A P x + B P y + C P z + D ) A D x + B D y + C D z D z ) \begin{aligned} P+t\mathbf{d} & = P -\frac{D + \mathbf{n}\cdot P}{\mathbf{n}\cdot \mathbf{d}}\mathbf{d}\\ &=\begin{pmatrix}P_x - \frac{\left(AP_x+BP_y +CP_z+D\right)}{AD_x +BD_y+CD_z}D_x\\ P_y - \frac{\left(AP_x+BP_y +CP_z+D\right)}{AD_x +BD_y+CD_z}D_y\\ P_z - \frac{\left(AP_x+BP_y +CP_z+D\right)}{AD_x +BD_y+CD_z}D_z\\ \end{pmatrix} \end{aligned} P+td=P−n⋅dD+n⋅Pd= Px−ADx+BDy+CDz(APx+BPy+CPz+D)DxPy−ADx+BDy+CDz(APx+BPy+CPz+D)DyPz−ADx+BDy+CDz(APx+BPy+CPz+D)Dz

3.若 n ⋅ d = 0 \mathbf{n}\cdot \mathbf{d}= 0 n⋅d=0,且 n ⋅ P + d = 0 \mathbf{n}\cdot P +d = 0 n⋅P+d=0,则直线与平面重合

4.若 n ⋅ d = 0 \mathbf{n}\cdot \mathbf{d}= 0 n⋅d=0,且 n ⋅ P + d ≠ 0 \mathbf{n}\cdot P +d \neq 0 n⋅P+d=0,则直线与平面无交点

参考:
https://zhuanlan.zhihu.com/p/404311333

相关推荐
KingRumn19 小时前
Linux信号之标准信号与实时信号
linux·算法
free-elcmacom21 小时前
深度学习<4>高效模型架构与优化器的“效率革命”
人工智能·python·深度学习·机器学习·架构
源代码•宸1 天前
Leetcode—620. 有趣的电影&&Q3. 有趣的电影【简单】
数据库·后端·mysql·算法·leetcode·职场和发展
2301_800256111 天前
地理空间数据库中的CPU 和 I/O 开销
数据库·算法·oracle
一个不知名程序员www1 天前
算法学习入门---结构体和类(C++)
c++·算法
Godspeed Zhao1 天前
自动驾驶中的传感器技术77——Sensor Fusion(0)
人工智能·机器学习·自动驾驶
XFF不秃头1 天前
力扣刷题笔记-旋转图像
c++·笔记·算法·leetcode
Coding茶水间1 天前
基于深度学习的学生上课行为检测系统演示与介绍(YOLOv12/v11/v8/v5模型+Pyqt5界面+训练代码+数据集)
图像处理·人工智能·深度学习·yolo·目标检测·机器学习·计算机视觉
王老师青少年编程1 天前
csp信奥赛C++标准模板库STL案例应用3
c++·算法·stl·csp·信奥赛·lower_bound·标准模版库