VectorDraw Developer Framework
问:我在vdPolyhatch中寻找Point-Inside-Test,如何实现/span>
答:这可以通过两种方法来实现,一种是使用vdPolyface的isPointInside方法(在你使用ToMesh方法将polyhatch “转化 “为一个多面体之后),另一种是使用polyhatch的GetFilledPolygons方法,该方法将返回一个 “gPoints “数组,你可以使用gPoints的IsPointInside检查。优选的是GetFilledPolygons方法。试试下面的代码(两种方法)。
gPoint pt = null; vdFigure fig = null; doc.Prompt(“ Select a Polyhatch”); doc.ActionUtility.getUserEntity(out fig,out pt); doc.Prompt(null); gPoint pointTocheck = null; doc.Prompt(“选择要检查的点”); StatusCode s = doc.ActionUtility.getUserPoint(out pointTocheck); doc.Prompt(null); if(s == StatusCode.Success && pointTocheck!= null) { //第一种方法是将多边形填充转换为多边形,然后使用多边形的isPointInside方法。 //注意,这种方式可能会有点慢,具体取决于多边形剖面线的复杂程度。 gPoint pointToCheckWorld = doc.User2WorldMatrix.Transform(pointTocheck); vdPolyhatch hatch =图为vdPolyhatch; if(hatch == null)返回; vdPolyface face = hatch.ToMesh(0); bool ret = face.isPointInside(pointToCheckWorld); //第二种方法是使用多边形填充的另一种方法,即GetFilledPolygons bool ret3 = false;。 vdArray区域= hatch.HatchProperties.GetFilledPolygons(0,0.0); foreach(区域中的gPoints项目) { if(item.IsPointInside(pointToCheckWorld)){ret3 = true; 休息; } } }
=======================================================
如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!