• 大小: 81KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-01
  • 语言: C#
  • 标签: c#  tin  

资源简介

c#语言 离散点生成tin模型,并插值生成等高线

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Threading;

namespace TINVoronoi
{
    public partial class Delaynay
    {
       
        public List HullPoint;  //凸壳顶点链表
        private struct PntV_ID
        {
            public long Value;
            public long ID;
        }
        
        //建立凸壳
        public void CreateConvex()
        {
            //初始化凸壳顶点链表
            if (HullPoint == null)
                HullPoint = new List();
            else
            {
                for (int i = 0; i < HullPoint.Count; i++)
                    DS.Vertex[HullPoint[i]].isHullEdge = 0;  //去除凸壳标记
                HullPoint.Clear();
            }

            #region 计算x-y和x+y的最大、最小点
            PntV_ID MaxMinus MinMinus MaxAdd MinAdd;
            MaxMinus.ID = MinMinus.ID = MaxAdd.ID = MinAdd.ID = DS.Vertex[0].ID;//用第一点初始化
            MaxMinus.Value = MinMinus.Value = DS.Vertex[0].x - DS.Vertex[0].y;
            MaxAdd.Value = MinAdd.Value = DS.Vertex[0].x + DS.Vertex[0].y;

            long temp;
            for (int i = 1; i < DS.VerticesNum; i++)
            {
                temp = DS.Vertex[i].x - DS.Vertex[i].y;
                if (temp > MaxMinus.Value)
                {
                    MaxMinus.Value = temp;
                    MaxMinus.ID = DS.Vertex[i].ID;
                }
                if (temp < MinMinus.Value)
                {
                    MinMinus.Value = temp;
                    MinMinus.ID = DS.Vertex[i].ID;
                }

                temp = DS.Vertex[i].x + DS.Vertex[i].y;
                if (temp > MaxAdd.Value)
                {
                    MaxAdd.Value = temp;
                    MaxAdd.ID = DS.Vertex[i].ID;
                }
                if (temp < MinAdd.Value)
                {
                    MinAdd.Value = temp;
                    MinAdd.ID = DS.Vertex[i].ID;
                }
            }
            #endregion

            //加入链表
            HullPoint.Add(MinMinus.ID);
            HullPoint.Add(MaxAdd.ID);
            HullPoint.Add(MaxMinus.ID); 
            HullPoint.Add(MinAdd.ID);
            //还要去除重复点……
            for (int i = 0; i < HullPoint.Count; i++)
            {
                if (HullPoint[i] == HullPoint[(i + 1) % HullPoint.Count])
                    HullPoint.RemoveAt(i);
            }

            //将点标记,下一步不再处理
            for (int i = 0; i < HullPoint.Count; i++)
                DS.Vertex[HullPoint[i]].isHullEdge = -1;  

            #region 插入其他点
            for (int i = 0; i < DS.VerticesNum; i++)
            {
                if (DS.Vertex[i].isHullEdge == -1)
                    continue;

                //判断点i与每条边的关系
                double isOnRight;
                for (int j = 0; j < HullPoint.Count; j++)
                {
                    PointF pnt1 = new P

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

     文件        919  2009-04-01 13:28  TINVoronoi.sln

    ..A..H.     15360  2009-04-01 13:34  TINVoronoi\TINVoronoi.suo

     文件       3804  2009-05-02 17:38  TINVoronoi\TINVoronoi.csproj

     文件       2535  2009-04-30 17:40  TINVoronoi\DataStruct.cs

     文件       6972  2009-05-02 16:54  TINVoronoi\ConvexTin.cs

     文件       6012  2009-05-02 18:22  TINVoronoi\Form1.resx

     文件       3942  2009-04-22 20:17  TINVoronoi\MySmallImage1.bmp

     文件       2054  2009-04-22 21:32  TINVoronoi\MySmallImage2.bmp

     文件      11859  2009-05-02 18:22  TINVoronoi\Form1.Designer.cs

     文件        469  2009-04-22 21:39  TINVoronoi\Program.cs

     文件        377  2009-05-06 01:09  TINVoronoi\obj\TINVoronoi.csproj.FileList.txt

     文件        180  2009-05-02 18:22  TINVoronoi\obj\Debug\TINVoronoi.Form1.resources

     文件        180  2009-04-11 11:28  TINVoronoi\obj\Debug\TINVoronoi.Properties.Resources.resources

     文件      40960  2009-05-05 16:33  TINVoronoi\obj\Debug\TINVoronoi.exe

     文件        180  2009-05-05 15:14  TINVoronoi\obj\Debug\TINVoronoi.DataMonitor.resources

     文件       4608  2009-05-02 17:33  TINVoronoi\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        906  2009-05-05 15:14  TINVoronoi\obj\Debug\TINVoronoi.csproj.GenerateResource.Cache

     文件      60928  2009-05-05 16:33  TINVoronoi\obj\Debug\TINVoronoi.pdb

     文件       5612  2009-04-01 13:28  TINVoronoi\Properties\Resources.resx

     文件        249  2009-04-01 13:28  TINVoronoi\Properties\Settings.settings

     文件       1176  2009-04-01 13:28  TINVoronoi\Properties\AssemblyInfo.cs

     文件       2842  2009-05-02 17:33  TINVoronoi\Properties\Resources.Designer.cs

     文件       1106  2009-05-02 17:33  TINVoronoi\Properties\Settings.Designer.cs

     文件      40960  2009-05-05 16:33  TINVoronoi\Debug\TINVoronoi.exe

     文件      60928  2009-05-05 16:33  TINVoronoi\Debug\TINVoronoi.pdb

     文件       2960  2009-05-05 15:46  TINVoronoi\Debug\PointsData.sfg

     文件        872  2009-05-02 18:10  TINVoronoi\Debug\PointsData111.sfg

     文件        680  2009-05-03 10:25  TINVoronoi\Debug\BadHull.sfg

     文件       1472  2009-05-03 10:31  TINVoronoi\Debug\BadHull61.sfg

     文件       3272  2009-05-04 14:33  TINVoronoi\Debug\PointsData136.sfg

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

评论

共有 条评论