欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    2022年求空间直线的交 .pdf

    • 资源ID:33385667       资源大小:40.22KB        全文页数:6页
    • 资源格式: PDF        下载积分:4.3金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要4.3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    2022年求空间直线的交 .pdf

    因为一个小任务需要用到求空间直线交点的MATLAB 函数和求空间中两个平面的相交线的函数, 但是在网上找了一下没有,只好自己写了几个函数,自己觉得还能用,在这里给大家分享一下。1.MATLAB求空间中的两个平面的相交线function flag,n,p = PlanePlane2Line(n1,p1,n2,p2)%-% calulate the line shared by two intersecting plane% input: % n1 normal vector of plane one% p1 any point on plane one% n2 normal vector of plane two% p2 any point on plane two% output:% flag whether the two planes are intersecting ( 1 or 0)% n the direction vector of the expected line% p any point in the expected line% author: Lai Zhenzhou from Harbin Institute of Technology% email: % date: 2014.1.16%-if(isvector(n1) & isvector(p1) & isvector(n2) & isvector(p2) error(PlanePlane2Line:the parameter is not vector); endif(length(n1)=3)|(length(p1)=3)|(length(n2)=3)|(length(p2)=3) error(PlanePlane2Line:the parameter is not 3d vector); endA = n1(1) n1(2) n1(3);n2(1) n2(2) n2(3);if(rank(A)2) flag = 0;else flag = 1;endif(flag=1)名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 6 页 - - - - - - - - - % calculate the normal vector n = cross(n1,n2); c1 = n1(1) n1(2) n1(3) -dot(n1,p1); c2 = n2(1) n2(2) n2(3) -dot(n2,p2); % calculate the simplest Row echelon matrix temp1 = rref(A); temp2 = 1 2 3; index(1) = find(temp1(1,:),1,first); % the first nonzero element index(2) = find(temp1(2,:),1,first); % the first nonzero element D = A(:,index(1) A(:,index(2); Y = dot(n1,p1);dot(n2,p2); X = inv(D)*Y;for i=1:3if(i=index(1) & i=index(2) index(3) = i;endend p(index(1) = X(1); p(index(2) = X(2); p(index(3) = 0;else n=; p=;end%-for test-% flag n p = PlanePlane2Line(1 2 3,1 0 1,2 3 4,0 -1 0)% flag n p = PlanePlane2Line(0 0 1,0.5 0.5 0.5,1 0 0,0 0 1)名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 6 页 - - - - - - - - - 2.MATLAB求空间中两条直线的交点function flag,p = LineLine2Point(n1,p1,n2,p2)%-% determine the relation between two straight lines and% calulate the intersection point if they are intersecting% input:% n1 direction vector of line one% p1 any point in line one% n2 direction vector of line two% p2 any point in line two% output:% flag the relation of the two line% flag = 0 the two line are on different plane % flag = 1 the two line are on the same plane and they are parallel% flag = 2 the two line are on the same plane and they are intersecting% p the point shared by the two intersecting line% author: Lai Zhenzhou from Harbin Institute of Technology% email: % date: 2014.1.17% reference: http:/ & isvector(p1) & isvector(n2) & isvector(p2) error(LineLine2Point: the parameter is not vector); endif(length(n1)=3)|(length(p1)=3)|(length(n2)=3)|(length(p2)=3) error(LineLine2Point: the parameter is not 3d vector); endA = p2(1)-p1(1) p2(2)-p1(2) p2(3)-p1(3); n1(1) n1(2) n1(3) ; n2(1) n2(2) n2(3) ;if(det(A)=0)名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 6 页 - - - - - - - - - flag = 0;elseif(rank(A(2:3,:)2) flag = 1;else flag = 2;endendif(flag = 2) B = rref(A(2:3,:); index(1) = find(B(1,:),1,first); index(2) = find(B(2,:),1,first);for i=1:3if(i=index(1) & i=index(2) index(3) = i;endend Y(1,1) = -p1(index(1) + p2(index(1); Y(2,1) = -p1(index(2) + p2(index(2); D = n1(index(1) -n2(index(1);n1(index(2) -n2(index(2); t = inv(D)*Y; p(1) = p1(1) + n1(1)*t(1); p(2) = p1(2) + n1(2)*t(1); p(3) = p1(3) + n1(3)*t(1);else p = ;endend%-for test-% flag p = LineLine2Point(1 0 0,0 0 0,0 1 0,1 1 0)名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 6 页 - - - - - - - - - % flag p = LineLine2Point(1 1 0,0 0 0,0 1 0,1 1 0)% flag p = LineLine2Point(1 1 -1,0 0 1,0 1 0,1 1 0)% flag p = LineLine2Point(1 1 -1,0 0 1,1 1 -1,1 1 0)% flag p = LineLine2Point(1 1 1,0 0 0,2 0 0,2 1 1)% flag p = LineLine2Point( 0 -42050 -21025,-100 0 0,0 0 145,0 0 0)3.MATLAB求空间中直线和某一线段的交点function flag,p = LineSegment2Point(n1,p1,p21,p22)%-% determine the relation between a straight line and% a line segment and calulate the intersecting point% if they are intersecting% input:% n1 direction vector of the straight line % p1 any point in the straight line% p21 any point in the line segment% p22 any another different point in the line segment% output:% flag the relation of the two line% flag = 0 the straight line and line segment are not intersecting% flag = 1 the straight line and line segment are intersecting% p the point shared by the two intersecting line% author: Lai Zhenzhou from Harbin Institute of Technology% email: % date: 2014.1.17%-if(isvector(n1) & isvector(p1) & isvector(p21) & isvector(p22) error(LineSegment2Point: the parameter is not vector); endif(length(n1)=3)|(length(p1)=3)|(length(p21)=3)|(length(p22)=3) error(LineSegment2Point: the parameter is not 3d vector); endif(p21(1)=p22(1)&(p21(2)=p22(2)&(p21(3)=p22(3) error(LineSegment2Point: the two appointed points of line segment are 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 6 页 - - - - - - - - - the same); end%calculate the direction vector of line segmentn2 = p22(1)-p21(1),p22(2)-p21(2),p22(3)-p21(3);flag0,p0 = LineLine2Point(n1,p1,n2,p21);if(flag0 = 2)if(norm(p0-p21)=norm(p22-p21) & norm(p0-p22)=norm(p22-p21) flag = 1; p = p0;else flag = 0; p=;endelse flag = 0; p=;endend%-for test-% flag p = LineSegment2Point(0 0 1,0 0 0,0 1 1,0 2 1)% flag p = LineSegment2Point(1 1 1,0 0 0,0 1 1,0 2 1)% flag p = LineSegment2Point(1 1 1,0 0 0,0 1 1,1 1 1)% flag p = LineSegment2Point(1 1 1,0 0 0,0 1 1,2 1 1)名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 6 页 - - - - - - - - -

    注意事项

    本文(2022年求空间直线的交 .pdf)为本站会员(H****o)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开