資源簡介
可以繪制各種類型的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個文件信息
- 上一篇:STM32HAL_BH1750驅動_模擬IIC
- 下一篇:8天學會ansys命令流
評論
共有 條評論