• 大小: 338KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: C#
  • 标签: Delaunay  Tin  C#  

资源简介

这是自己写的Delaunay三角剖分源码和所用的算法的具体描述,C#版本,实现了最基本的功能。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Delaunay_WinForm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void exitToolStripMenuItem_Click(object sender EventArgs e)
        {
            this.Close();
        }

        List triPoint = new List();
        List triEdgeTemp = new List();
        List listTriangle = new List();
        List circumPoints = new List();
        private void 生成DelaunayToolStripMenuItem_Click(object sender EventArgs e)
        {
            this.pictureBox1.Refresh();
            foreach (PointF p in points)
            {
                DrawingPoints(p);
            }
            FirstTriangle();
            BuildDelaunay();
            List edges = new List();
            edges = Triangle.GetEdges(listTriangle);
            TriEdge.GetUniqueEdges(edges);
            DrawingLines(edges);
            listTriangle.Clear();
            triPoint.Clear();
        }

        private void FirstTriangle()
        {
            for (int i = 0; i < points.Count; i++)
            {
                TriPoint p = new TriPoint();
                p.point = points[i];
                p.ID = i + 1;
                triPoint.Add(p);
            }
            int index = 0;
            double length = double.MaxValue;
            foreach (TriPoint p1 in triPoint)
            {
                double temp = TriEdge.LengthSquare(triPoint[0] p1);
                if (temp != 0 && temp < length)
                {
                    index = p1.ID;
                    length = temp;
                }
            }
            TriPoint point1 point2 point3;
            point1 = triPoint[0];
            point3 = triPoint[index - 1];
            if (point1 != null && point3 != null)
            {
                TriEdge edge = new TriEdge(point1 point3);
                point2 = TriEdge.GetBestPoint(edge triPoint);
                if (point2 != null)
                {
                    TriEdge triEdge1 = new TriEdge(point1 point2);
                    TriEdge triEdge2 = new TriEdge(point2 point3);
                    TriEdge triEdge3 = new TriEdge(point3 point1);
                    Triangle angle = new Triangle(point1 point2 point3);
                    angle.edge1 = triEdge1;
                    angle.edge2 = triEdge2;
                    angle.edge3 = triEdge3;
                    triEdge1.leftTriangle = angle;
                    triEdge2.leftTriangle = angle;
                    triEdge3.leftTriangle = angle;
                    triEdgeTemp.Add(triEdge1);
                    triEdgeTemp.Add(triEdge2);
            

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      18432  2011-03-21 14:43  Delaunay_WinForm\Delaunay_WinForm\bin\Debug\Delaunay_WinForm.exe

     文件      50688  2011-03-21 14:43  Delaunay_WinForm\Delaunay_WinForm\bin\Debug\Delaunay_WinForm.pdb

     文件      14328  2011-03-21 14:44  Delaunay_WinForm\Delaunay_WinForm\bin\Debug\Delaunay_WinForm.vshost.exe

     文件        490  2009-06-11 05:14  Delaunay_WinForm\Delaunay_WinForm\bin\Debug\Delaunay_WinForm.vshost.exe.manifest

     文件       3859  2011-03-13 20:49  Delaunay_WinForm\Delaunay_WinForm\Delaunay_WinForm.csproj

     文件       9363  2011-03-13 21:39  Delaunay_WinForm\Delaunay_WinForm\Form1.cs

     文件       7951  2011-03-13 21:01  Delaunay_WinForm\Delaunay_WinForm\Form1.Designer.cs

     文件       6213  2011-03-13 21:01  Delaunay_WinForm\Delaunay_WinForm\Form1.resx

     文件        779  2011-03-21 14:44  Delaunay_WinForm\Delaunay_WinForm\obj\Debug\Delaunay_WinForm.csproj.FileListAbsolute.txt

     文件        847  2011-03-13 21:01  Delaunay_WinForm\Delaunay_WinForm\obj\Debug\Delaunay_WinForm.csproj.GenerateResource.Cache

     文件      18432  2011-03-21 14:43  Delaunay_WinForm\Delaunay_WinForm\obj\Debug\Delaunay_WinForm.exe

     文件        180  2011-03-13 21:01  Delaunay_WinForm\Delaunay_WinForm\obj\Debug\Delaunay_WinForm.Form1.resources

     文件      50688  2011-03-21 14:43  Delaunay_WinForm\Delaunay_WinForm\obj\Debug\Delaunay_WinForm.pdb

     文件        180  2011-03-13 20:49  Delaunay_WinForm\Delaunay_WinForm\obj\Debug\Delaunay_WinForm.Properties.Resources.resources

     文件        497  2011-03-13 20:14  Delaunay_WinForm\Delaunay_WinForm\Program.cs

     文件       1364  2011-03-13 20:14  Delaunay_WinForm\Delaunay_WinForm\Properties\AssemblyInfo.cs

     文件       2882  2011-03-13 20:14  Delaunay_WinForm\Delaunay_WinForm\Properties\Resources.Designer.cs

     文件       5612  2011-03-13 20:14  Delaunay_WinForm\Delaunay_WinForm\Properties\Resources.resx

     文件       1101  2011-03-13 20:14  Delaunay_WinForm\Delaunay_WinForm\Properties\Settings.Designer.cs

     文件        249  2011-03-13 20:14  Delaunay_WinForm\Delaunay_WinForm\Properties\Settings.settings

     文件       3715  2011-03-13 20:40  Delaunay_WinForm\Delaunay_WinForm\Triangle.cs

     文件       4128  2011-03-13 20:51  Delaunay_WinForm\Delaunay_WinForm\TriEdge.cs

     文件       1958  2011-03-13 20:41  Delaunay_WinForm\Delaunay_WinForm\TriPoint.cs

     文件        938  2011-03-13 20:14  Delaunay_WinForm\Delaunay_WinForm.sln

    ..A..H.     17920  2011-03-21 14:44  Delaunay_WinForm\Delaunay_WinForm.suo

     目录          0  2011-03-13 20:43  Delaunay_WinForm\Delaunay_WinForm\obj\Debug\Refactor

     目录          0  2011-03-13 20:14  Delaunay_WinForm\Delaunay_WinForm\obj\Debug\TempPE

     目录          0  2011-03-13 21:16  Delaunay_WinForm\Delaunay_WinForm\bin\Debug

     目录          0  2011-03-21 14:43  Delaunay_WinForm\Delaunay_WinForm\obj\Debug

     目录          0  2011-03-13 20:31  Delaunay_WinForm\Delaunay_WinForm\bin

............此处省略8个文件信息

评论

共有 条评论