VectorDraw常见问题整理:如何围绕某个点旋转折线中的顶点?
2019-09-10 17:04
746 查看
VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。
VectorDraw web library (javascript)不仅能打开CAD图纸,而且能显示任何支持HTML5标准平台上的通用矢量对象,如Windows,安卓,iOS和Linux。无需任何安装,VectorDraw web library (javascript)就可以运行在任何支持canvas标签和Javascript的主流浏览器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。这意味着可以用DXF,DWG,DGN,SKP(Google的Sketchup),VDML等多种格式在任何台式、平板电脑,智能手机和便携式笔记本上展现出你的业务。
问:
如何(通过代码)可以围绕某个点旋转折线中的某些顶点,保持其他顶点相同?
答:
这个问题非常简单,您可以尝试以下代码:
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常见问题整理:透明度如何在VDF中运行?
- PS常见问题01——如何旋转纸张
- C#.NET常见问题(FAQ)-Visual Studio VS如何显示行号
- Extjs 常见问题:如何提交combobox的值
- WM 模拟器常见问题如何联网、打电话、发送短信、连接GPRS等
- 【java常见问题】——如何遍历目录中所有文件?
- Windows7常见问题整理
- 整理iBATIS的一些重要点和一些常见问题的解决
- [整理]Svn常见问题汇总。
- [55] 测试技术常见的十一种问题之三:如何理解压力、负载、性能测试测试?
- Git常见问题整理
- LoadRunner常见问题整理
- 常见表单重复提交问题整理及解决方法-点击链接加入群【农产品一体化解决方案】:https://jq.qq.com/?_wv=1027&k=49BAOCe
- Parasoft C/C++test 常见问题整理大全(二)
- 搜集整理了Object-C现阶段学习中常见的问题
- Android面试常见问题:如何在不发一个新版本的情况下更新App布局?
- 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-人机界面如何设置页面跳转
- 加密保护软件 WinLicense常见问题整理大全(一)
- 常见css布局问题整理
- C#.NET常见问题(FAQ)-如何捕捉窗体关闭的事件,弹窗确认是否退出