翻譯|使用教程|編輯:況魚杰|2019-09-03 13:51:51.633|閱讀 306 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學習,本節教程將會介紹如何圍繞某個點旋轉折線中的頂點。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問:
如何(通過代碼)可以圍繞某個點旋轉折線中的某些頂點,保持其他頂點相同?
答:
這個問題非常簡單,您可以嘗試以下代碼:
private void MyButton_Click(object sender, EventArgs e) { vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument; doc.New(); Vertexes vrts = new Vertexes(); vrts.Add(1,1,0,0);vrts.Add(1,4,0,0);vrts.Add(4,4,0,0);vrts.Add(5,3,0,0); vdPolyline pl = new vdPolyline(doc, vrts); doc.Model.Entities.AddItem(pl); pl.Invalidate(); //--------------- created the polyline --------- // rotate it for 45 degrees anti-clockwise around vertex[1] Vertexes orig_vert = new Vertexes(pl.VertexList);//get the vertex list of the polyline that will be changed gPoint pt1 = new gPoint(orig_vert[1] as gPoint); // Vertexes from Item 2 and above will change Vertexes keep = new Vertexes(); keep.Add(new Vertex(orig_vert[0])); keep.Add(new Vertex(orig_vert[1])); double orig_angle = pt1.GetAngle( orig_vert[2] as gPoint); // new angle orig_angle += VectorDraw.Geometry.Globals.DegreesToRadians(45.0d); Matrix mat = new Matrix(); mat.TranslateMatrix(-1.0d * pt1); mat.RotateZMatrix(orig_angle); mat.TranslateMatrix(pt1); mat.Transform(orig_vert); // this will produce the new vertexes for (int i = 0; i < 2; i++) { orig_vert[i] = keep[i]; // restore the vertexes that didn't changed } pl.VertexList = orig_vert; pl.Update(); pl.Invalidate(); }
相關資料推薦:
VectorDraw Developer Framework(VDF)示例
如果您對想要購買正版授權VectorDraw Developer Framework(VDF),可以聯系咨詢相關問題。
關注慧聚IT微信公眾號 ???,了解產品的最新動態及最新資訊。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: