扬中本地网站,室内设计公司排行榜,花瓣网设计官网,网站什么也没动怎么不收录啦目录
空间中点到线段的距离
空间中点到平面的投影和距离
matlab代码
空间中点到线段的距离 空间中点到平面的投影和距离 matlab代码
function [dis,P2,t] point2Line (A1,B1,C1)
%求空间一点到一线段的最短距离
%[dis,P2,Q2]pointSegmentDistance(A,B,C)
%A B为线段首末端…目录
空间中点到线段的距离
空间中点到平面的投影和距离
matlab代码
空间中点到线段的距离 空间中点到平面的投影和距离 matlab代码
function [dis,P2,t] point2Line (A1,B1,C1)
%求空间一点到一线段的最短距离
%[dis,P2,Q2]pointSegmentDistance(A,B,C)
%A B为线段首末端点C为空间一点
%dis为最短距离 P2 Q2为最短距离的首末端点% 取0~1时P点在线段AB上滑动1 P点在B端点外0 P点在A端点外
A B1(1)-A1(1);
B B1(2)-A1(2);
C B1(3)-A1(3);
D A1(1)-C1(1);
E A1(2)-C1(2);
F A1(3)-C1(3);
t -(A*DB*EC*F)/(A*AB*BC*C);
if t1t1;
elseif t0t0;
end
x1 A1(1) A*t;
y1 A1(2) B*t;
z1 A1(3) C*t;
dis sqrt((x1-C1(1))^2(y1-C1(2))^2(z1-C1(3))^2);
P2 [x1 ,y1,z1];
end
function resultPoint2planceDis(P,n,Pn)
% output
% result 为点到平面的距离
% input
% P空间中一点 n为平面的单位法向量Pn为平面上一点A n(1)*P(1)n(2)*P(2)n(3)*P(3);
B n(1)*Pn(1)n(2)*Pn(2)n(3)*Pn(3);
C n(1)^2n(2)^2n(3)^2;
t (A-B)/C;
x P(1)-t*n(1);
y P(2)-t*n(2);
z P(3)-t*n(3);
%投影点坐标
Q [x,y,z];
%距离
PQ P-Q;
result norm(PQ);
end
下一章空间解析几何4-空间中点到椭圆的距离【附MATLAB代码】