翻譯|使用教程|編輯:況魚杰|2019-08-19 14:55:27.643|閱讀 851 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學(xué)習(xí),本節(jié)教程將會(huì)介紹如何排除GroundSurface對(duì)象的三角形區(qū)域。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
點(diǎn)開本篇文章,是否對(duì)矢量圖形工具感興趣呢?來看看最新的矢量圖形工具測(cè)評(píng)吧!點(diǎn)擊此處>>即可直達(dá)哦!
問:
如何排除GroundSurface對(duì)象的三角形區(qū)域?
答:
在6022中添加了新方法VectorDraw.Geometry.Delaunay.Triangulate和GetSliceRegionPoints of gPoints。
public static gTriangles Triangulate(gPoints points,ushort precision)
使用Delaunay算法對(duì)給定點(diǎn)進(jìn)行三角測(cè)量。
要點(diǎn):輸入樣本點(diǎn)進(jìn)行三角測(cè)量。
precision:傳遞點(diǎn)的小數(shù)精度。
返回:gTriangles集合。
gPoints GetSliceRegionPoints(vdArray
返回SliceRegions中所有點(diǎn)的集合,區(qū)域之間的所有交叉點(diǎn)以及區(qū)域段與此Triangle集合之間的所有交集。
SliceRegions:區(qū)域集合。
precision:傳遞點(diǎn)的小數(shù)精度。
返回屬于在此集合的三角形上投影的SliceRegions的所有點(diǎn)的集合。
從三角測(cè)量中排除區(qū)域的示例
//create an array of points that represent a mountain gPoints pts = new gPoints(); //add points from a 16 segments divided circle with radius 10 and elevation 50 pts += Globals.GetArcSamplePoints(16, 10, 0.0, Globals.VD_TWOPI, 50); //add points from a 32 segments divided circle with radius 20 and elevation 40 pts += Globals.GetArcSamplePoints(32, 20, 0.0, Globals.VD_TWOPI,40); //add points from a 48 segments divided circle with radius 30 and elevation 30 pts += Globals.GetArcSamplePoints(48, 30, 0.0, Globals.VD_TWOPI,30); //add points from a 64 segments divided circle with radius 40 and elevation 20 pts += Globals.GetArcSamplePoints(64, 40, 0.0, Globals.VD_TWOPI,20); //add points from a 78 segments divided circle with radius 50 and elevation 10 pts += Globals.GetArcSamplePoints(78, 50, 0.0, Globals.VD_TWOPI,10); //add a point at the top of the mountain. pts += new gPoint(0, 0, 60); //create an array of points that defines a region that will not contains triangles inside gPoints SliceRegionInside = new gPoints(new gPoint[] { new gPoint(-18, 3), new gPoint(-18, 18), new gPoint(-3, 18), new gPoint(-3, 3), new gPoint(-18, 3) }); //create an array of points that defines a region that will not contains triangles outside it. gPoints SliceRegionOutside = new gPoints(new gPoint[] { new gPoint(-35, -35), new gPoint(-35, 35), new gPoint(35, 35), new gPoint(35, -35), new gPoint(-35, -35) }); //add all the regions into a collection vdArray SliceRegions = new vdArray(new gPoints[] { SliceRegionInside, SliceRegionOutside }); ushort percision = 8; //calculate the result triangles using decimal precision 8 for passed points. gTriangles newtriangles = Delaunay.Triangulate(pts, percision); //calculate all intersection points between SliceRegions and triangles. //Z values of intersections are projected on triangles collection. gPoints intPts = newtriangles.GetSliceRegionPoints(SliceRegions, percision); //re-calculate the triangles using the basic input points and the calculated intersections. newtriangles = Delaunay.Triangulate(pts + intPts, percision); //remove the triangles according to region usage. gTriangles RemovedInsideTriangles = newtriangles.RemoveInsideTriangles(SliceRegionInside); gTriangles RemovedOutsideTriangles = newtriangles.RemoveOutsideTriangles(SliceRegionOutside); //create a new ground sourface with the calculating triangles. vdGroundSurface gf = new vdGroundSurface(); gf.SetUnRegisterDocument(doc); gf.setDocumentDefaults(); gf.Points = pts; gf.SelectUserTriangles(newtriangles); gf.DispMode = vdGroundSurface.DisplayMode.Triangle; doc.Model.Entities.AddItem(gf); doc.CommandAction.Zoom("e", null, null);
關(guān)注慧聚IT微信公眾號(hào) ???,了解產(chǎn)品的最新動(dòng)態(tài)及最新資訊。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: