平面和射线交点

设平面 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

相关推荐
聚客AI4 小时前
🙋‍♀️Transformer训练与推理全流程:从输入处理到输出生成
人工智能·算法·llm
大怪v7 小时前
前端:人工智能?我也会啊!来个花活,😎😎😎“自动驾驶”整起!
前端·javascript·算法
惯导马工9 小时前
【论文导读】ORB-SLAM3:An Accurate Open-Source Library for Visual, Visual-Inertial and
深度学习·算法
骑自行车的码农10 小时前
【React用到的一些算法】游标和栈
算法·react.js
博笙困了10 小时前
AcWing学习——双指针算法
c++·算法
moonlifesudo11 小时前
322:零钱兑换(三种方法)
算法
NAGNIP1 天前
大模型框架性能优化策略:延迟、吞吐量与成本权衡
算法
美团技术团队1 天前
LongCat-Flash:如何使用 SGLang 部署美团 Agentic 模型
人工智能·算法
AI小云1 天前
【机器学习与实战】回归分析与预测:线性回归-03-损失函数与梯度下降
机器学习
Fanxt_Ja1 天前
【LeetCode】算法详解#15 ---环形链表II
数据结构·算法·leetcode·链表