下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、垂距法与道格拉斯-普克法删除冗余顶点效率的比较彭认灿,董 箭,郑义东,李改肖(大连舰艇学院 海洋测绘工程系,辽宁 大连116018)道格拉斯-普克法可描述为:将一条曲线首末顶点虚连一条直线,求出其余各顶点到该直线的距离,选其最大者与规定的限差相比较,若小于等于限差,则将直线两端间各点全部删去;若大于限差,则离该直线距 离最大的顶点保留,并以此为界,把曲线分为两部分,对这两部分重复 使用上述方法,直至最终无法作进一步的压缩为止(见图3)。1_I (限蔓竹)处理涌7道格拉斯2普克法有一个十分突出的优点 ,即它是一个整体算法,在一般情况下可保留较大弯曲形态上的特征点。经道格拉斯-普克法压缩后得到的图
2、形如图4所示。由于该算法可准确删除小弯曲上的定点,故能从体上有效地保持线要素的形态特征。正是因为道格拉斯-普克法具有这样突出的优点,所以已经在线要素地自动制图中得到了较广泛 的应用。但道格拉斯-普克法较垂距法复杂,且通常编程实现时需要采 用递归方,有一定的难度。一I (限差)(町处理前的图形图4道格拉斯普克法町有效保持线更素 的形态特征 转载end此算法可以在获取手写笔顺的特征点时应用。C+代码/= double PerpendicularDistance(CPoint Point1, CPoint Point2, CPointPoi nt)/Area = |(1/2)(x1y2 + x2y3
3、 + x3y1 - x2y1 - x3y2 - x1y3)|*Area oftria ngle/Base = v(x1-x2)2+(x1-x2)2)*Base ofTrian gle*/Area = .5*Base*H*Solve for height/Height = Area/.5/Basedouble area = abs(0.5 * (Poi ntl.x * Poi nt2.y + Poi nt2.x * Poi nt.y +Poi nt.x * Poi ntl.y - Poi nt2.x * Poi ntl.y - Poi nt.x * Poi nt2.y - Poi ntl.x *
4、Point.y);double bottom = sqrt(pow(Po in tl.x - Poin t2.x, 2) + pow(Po in tl.y - Point2.y, 2);double height = area / bottom * 2;return height;void DouglasPeuckerReducti on( vectorvCPo in t>po in ts, int firstPoi nt, int lastPo int, double tolera nee, listv int> &pointln dexsToKeep) double m
5、axDista nee = 0;int in dexFarthest = 0;for (i nt in dex = firstPo int; in dex < lastPo int; in dex+)double dista nee = Perpe ndicularDista nee(po in tsfirstPo in t, poin tslastPo in t, poin tsi ndex);if (dista nee > maxDista nee)maxDista nee = dista nee;in dexFarthest = in dex;if (maxDista nee
6、 > tolera nee && in dexFarthest != 0)/Add the largest point that exceeds the tolera neepoin tl ndexsToKeep.push_back(i ndexFarthest);DouglasPeuckerReducti on( poin ts, firstPo int,in dexFarthest, tolera nee, poin tl ndexsToKeep);DouglasPeuckerReducti on(poin ts, in dexFarthest,lastPo int,
7、 tolera nee, pointin dexsToKeep);veetor<CPoi nt> DouglasPeueker(veetor<CPoi nt> & Poi nts, double Tolera nee)if (Poi nts.empty() | (Poi nts.size() < 3)return Poi nts;int firstPo int = 0;int lastPo int = Poin ts.size() - 1;list< int> pointin dexsToKeep ;/Add the first and las
8、t in dex to the keeperspoin tI ndexsToKeep.push_back(firstPo in t);poin tI ndexsToKeep.push_back(lastPo in t);/The first and the last point cannot be the samewhile (Poi ntsfirstPoi nt=(Poi ntslastPoi nt)lastPoi nt-;DouglasPeuckerReducti on (Po in ts, firstPo in t, lastPo int, Tolera nee, poin tI ndexsToKeep);vectorvCPoi nt> returnPoi nts ;poin ti ndexsToKeep.sort();list<i nt>:iterator theiterator;for( theiterator = pointin dexsToKeep.b
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 温州商学院《现代汉语词汇研究A》2024-2025学年第二学期期末试卷
- 2026年华北有色工程勘察院有限公司第二批公开招聘工作人员3名笔试备考题库及答案解析
- 2026山东威海长青海洋科技股份有限公司博士后科研工作站招聘2人考试参考题库及答案解析
- 2026中国电信股份有限公司蒙城分公司“乐土镇”外包人员招聘1人笔试模拟试题及答案解析
- 2026江西省邮电建设工程有限公司华中事业部招聘1人考试参考题库及答案解析
- 2026华丞电子春季校园招聘笔试备考试题及答案解析
- 2026西藏林芝市工商联招聘党务工作者、公益性岗位工作人员2人笔试模拟试题及答案解析
- 2026内蒙古鄂尔多斯市恩格贝生态旅游区招聘2人笔试备考试题及答案解析
- 医共体内部人事管理制度
- 工资与人事内部控制制度
- 中国当代文学史试题与答案(8套)
- 初三数学总复习教学策略课件
- 椎管内麻醉-椎管内解剖课件
- 第三讲-就业信息的收集与处理课件
- 天津大学讲义-工程成本管理概述
- 环境与可持续发展ppt课件(完整版)
- Linux操作系统课件(完整版)
- 商业银行实施资本管理高级方法监管暂行细则
- 部编版七年级历史(下)全册教案
- 第三课美丽的彩衣陶艺装饰和烧成工艺 (2)
- 浙美版小学六年级美术下册全册精品必备教学课件
评论
0/150
提交评论