91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .cs
    金幣: 1
    下載: 1 次
    發布日期: 2021-06-05
  • 語言: C#
  • 標簽: C#??道格拉斯??Douglas??

資源簡介

Douglas一Peukcer算法是目前公認的線狀要素化簡經典算法。C#編寫,使用很方便

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Collections;
using?System.Drawing;

namespace?MapControlApplication2
{
????class?Douglasclass
????{
????????///?
????????///?使用“道格拉斯—普克”算法減少點的數量
????????///?

????????///?需要減少的點
????????///?偏差
????????///?得到減少過后的結果點
????????public?List?DouglasPeuckerReduction(List?Points?Double?Tolerance)
????????{
????????????//if?(Tolerance?==?0)?return?Points;
????????????if?(Points?==?null?||?Points.Count?????????????????return?Points;
????????????Int32?firstPoint?=?0;
????????????Int32?lastPoint?=?Points.Count?-?1;
????????????List?pointIndexsToKeep?=?new?List();
????????????//把第一個點和最后一個點的序號加入要保存的序號?對于數據中第一個和最后一個點重合的情況不壓縮
????????????pointIndexsToKeep.Add(firstPoint);
????????????pointIndexsToKeep.Add(lastPoint);
????????????//第一個點和最后一個點不能為同一個點
????????????while?(Points[firstPoint].Equals(Points[lastPoint]))
????????????{
????????????????lastPoint--;
????????????}
????????????DouglasPeuckerReduction(Points?firstPoint?lastPoint?Tolerance?ref?pointIndexsToKeep);//道格拉斯-普克壓縮
????????????List?returnPoints?=?new?List();
????????????pointIndexsToKeep.Sort();//對保留下來的序號進行排序
????????????foreach?(Int32?index?in?pointIndexsToKeep)
????????????{
????????????????returnPoints.Add(Points[index]);//將對應序號的點加入
????????????}
????????????return?returnPoints;//返回壓縮后的點
????????}
????????

????????///?
????????///?道格拉斯-普克壓縮
????????///?

????????///?要處理的點
????????///?第一個點
????????///?最后一個點
????????///?偏差
????????///?要保留點的索引號
????????private?static?void?DouglasPeuckerReduction(List?points?Int32?firstPoint?Int32?lastPoint?Double?tolerance?ref?List?pointIndexsToKeep)
????????{
????????????Double?maxDistance?=?0;
????????????Int32?indexFarthest?=?0;
????????????for?(Int32?inde

評論

共有 條評論