using System;
using System.Collections.Generic;
using System.IO;
namespace DouglasPeukerAlgorithm
{
class Program
{
static void Main(string[] args)
{
// 从txt文件中读取坐标
List<Point> points = ReadPointsFromFile("input.txt");
Console.WriteLine("请输入设置的阈值:");
double threshold = Convert.ToInt32(Console.ReadLine());
// 使用DouglasPeuker算法计算简化后的坐标
List<Point> simplifiedPoints = DouglasPeuker(points, threshold);
// 输出最终计算出的坐标
int i = 1;
foreach (Point point in simplifiedPoints)
{
Console.WriteLine($"[{i}] ({point.X}, {point.Y})");
i++;
}
Console.ReadLine();
}
// 定义坐标点类
class Point
{
public double X { get; set; }
public
GIS算法——c#道格拉斯扑克算法
于 2023-11-30 16:46:22 首次发布