• 大小: 942KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-17
  • 语言: 其他
  • 标签: b样条  

资源简介

可以绘制各种类型的b样条,包含均匀、准均匀、分段贝奇尔、一般非均匀(开森菲尔德方法),可以输入控制顶点、次数。

资源截图

代码片段和文件信息

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

namespace CAGDBSpline
{

    public partial class BSplineline
    {
        ///
        #region 定义b样条类的变量
        private int degree;//次数
        public int Degree
        {
            get { return degree; }
            set { degree = value; }
        }

        private int type;//b样条类型
        public int Type
        {
            get { return type; }
            set { type = value; }
        }

        private List points = new List();//控制顶点
        public List Points
        {
            get { return points; }
            set { points = value; }
        }

        private double[] differKnots;//相异的节点数组
        public double[] DifferKnots
        {
            get { return differKnots; }
            set { differKnots = value; }
        }
        public int[] Duplication;//节点重复度

        private int n;//n为曲线段数
        public int N
        {
            get { return n; }
            set { n = value; }
        }
        private PointF[] insertPoints = new PointF[1000];//一千个中间点

        public double[] baseFunctionX;//基函数横坐标上的点,与u值存在线性的映射关系
        public double[] baseFunctionY;//基函数Y值二维数组,用于存储每段基函数曲线上的不同u值对应的Y
        public PointF[] baseFunctionPoint;
        public PointF[] InsertPoints
        {
            get { return insertPoints; }
            set { insertPoints = value; }
        }

        #endregion 

        //构造方法
        public BSplineline()
        {
            degree = 1;
            type = 1;
        }

        #region  生成B样条中间点的方法,其中只有drawBSpline()方法对外开放访问权限
        private void drawUniform()//生成均匀B样条的节点
        {
            int i;
            n = points.Count + degree;
            if (n < 0)
            {
                MessageBox.Show(“您输入的次数过大或点过少!“);
                return;
            }
            differKnots = new double[n + 1];
            Duplication = new int[n + 1];
            double m = 1.0 / n;
            for (i = 0; i <= n; i++)
            {
                differKnots[i] = i * m;
                Duplication[i] = 1;
            }
        }
        private void drawQuniform()//准均匀B样条的节点
        {
            int i;
            n = points.Count - degree;
            if(n<0)
            {
                MessageBox.Show(“您输入的次数过大或点过少!“);
                return;
            }
            differKnots = new double[n + 1];
            Duplication = new int[n + 1];
            double m = 1.0 / n;
            for (i = 0; i <= n; i++)
            {
                differKnots[i] = i * m;
                if (i != 0 && i != n)
                    Duplication[i] = 1;
                else Duplication[i] = degree + 1;
            }
        }
        private void drawBezier()//分段Bez

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

     文件       1015  2018-03-03 10:03  CAGD\CAGD.sln

    ..A..H.     60416  2018-03-03 10:03  CAGD\CAGD.suo

    ..A..H.     72192  2018-03-27 11:08  CAGD\CAGD.v12.suo

     文件        187  2018-03-01 21:09  CAGD\WindowsFormsApplication1\App.config

     文件    3223552  2010-10-07 00:48  CAGD\WindowsFormsApplication1\bin\Debug\OpenTK.Compatibility.dll

     文件    2719744  2012-07-30 11:28  CAGD\WindowsFormsApplication1\bin\Debug\OpenTK.dll

     文件      24576  2010-10-07 00:47  CAGD\WindowsFormsApplication1\bin\Debug\OpenTK.GLControl.dll

     文件      47616  2018-03-21 11:01  CAGD\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

     文件        187  2018-03-01 21:09  CAGD\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config

     文件      93696  2018-03-21 11:01  CAGD\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb

     文件      23168  2018-03-27 11:03  CAGD\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe

     文件        187  2018-03-01 21:09  CAGD\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config

     文件        490  2016-03-09 13:48  CAGD\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest

     文件      13498  2018-03-09 22:31  CAGD\WindowsFormsApplication1\BSpline.cs

     文件      18790  2018-03-09 23:54  CAGD\WindowsFormsApplication1\BSplineSurface.cs

     文件       4756  2018-03-09 22:14  CAGD\WindowsFormsApplication1\CAGDBSpline.csproj

     文件        415  2018-03-09 22:14  CAGD\WindowsFormsApplication1\ClassDiagram1.cd

     文件      35598  2018-03-09 23:18  CAGD\WindowsFormsApplication1\Form1.cs

     文件      44197  2018-03-09 22:13  CAGD\WindowsFormsApplication1\Form1.Designer.cs

     文件       5817  2018-03-09 22:09  CAGD\WindowsFormsApplication1\Form1.resx

     文件       3334  2018-03-27 11:03  CAGD\WindowsFormsApplication1\obj\Debug\CAGDBSpline.csproj.FileListAbsolute.txt

     文件       1093  2018-03-09 22:09  CAGD\WindowsFormsApplication1\obj\Debug\CAGDBSpline.csproj.GenerateResource.Cache

     文件      46139  2018-03-21 11:01  CAGD\WindowsFormsApplication1\obj\Debug\CAGDBSpline.csprojResolveAssemblyReference.cache

     文件        180  2018-03-09 22:14  CAGD\WindowsFormsApplication1\obj\Debug\CAGDBSpline.Form1.resources

     文件        180  2018-03-09 22:14  CAGD\WindowsFormsApplication1\obj\Debug\CAGDBSpline.Properties.Resources.resources

     文件      37559  2018-03-27 11:03  CAGD\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7255  2018-03-27 11:03  CAGD\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2018-03-01 21:09  CAGD\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2018-03-01 21:09  CAGD\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2018-03-01 21:09  CAGD\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

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

评论

共有 条评论