AutoCAD Geometry 中BoundedPlane 是平行四边形,不是三角形

第一次使用这个类,
起初以为这个BoundedPlane 是三角形,
没想到在求取交点时,
有交点位于三角形之外,
在QQ群193522571中请教,
群友45168391告诉我BoundedPlane是平行四边形,
不是三角形,
并且告诉我需要对对加过进行判断,
或者简单的求两次,
用不同的BoundedPlane的来求,
都能得到交点,
交点必然在三角形之中。
Point3d p1 = new Point3d(); Point3d p2 = new Point3d(3, 0, 0); Point3d p3 = new Point3d(1, 3, 0); Point3d p4 = new Point3d(3, 2, 0); Point3d p5 = new Point3d(3, 2, 1); Point3d p6 = new Point3d(3, 4, 0); Point3d p7 = new Point3d(3, 4, 1); BoundedPlane bp1 = new BoundedPlane(p1, p2, p3); BoundedPlane bp2 = new BoundedPlane(p2, p3, p1); BoundedPlane bp3 = new BoundedPlane(p3, p1, p2); var l1 = new LineSegment3d(p4, p5); var l2 = new LineSegment3d(p6, p7); var pts11 = l1.IntersectWith(bp1); var pts12 = l1.IntersectWith(bp2); var pts13 = l1.IntersectWith(bp3); var pts21 = l2.IntersectWith(bp1); var pts22 = l2.IntersectWith(bp2); var pts23 = l2.IntersectWith(bp3); if (pts11 != null) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("bp11交点个数为:" + pts11.Length); } if (pts12 != null) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("bp12交点个数为:" + pts12.Length); } if (pts13 != null) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("bp13交点个数为:" + pts13.Length); } if (pts21 != null) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("bp21交点个数为:" + pts21.Length); } if (pts22 != null) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("bp22交点个数为:" + pts22.Length); } if (pts23 != null) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("bp23交点个数为:" + pts23.Length); }
这几天比较忙,
没有时间进行一步研究,
只能简单记录一下,
有遇到类似问题的朋友可以继续研究一下。
分类:
AutoCAD API相关
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2020-09-28 使用RibbonPanelBreak创建Slide-Out Panel遇到的问题
2017-09-28 自动加载简介