翻譯|使用教程|編輯:李顯亮|2021-03-18 09:50:20.877|閱讀 263 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學習。本文將會介紹如何查找vdPolyhatch中是否有內部測試點。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。該庫還支持許多矢量和柵格輸入和輸出格式,包括本地PDF和SVG導出。
點擊下載VectorDraw Developer Framework
問:我在vdPolyhatch中尋找Point-Inside-Test,如何實現?
答:這可以通過兩種方法來實現,一種是使用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),可以聯系咨詢相關問題。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn