• 大小: 1.58MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-31
  • 语言: 其他
  • 标签: VS2005  

资源简介

已知插值点,反求控制点来拟合NURBS拟合。interpolate是Nurbs曲线拟合,conn_interpolate实现曲线顺接还未完成,程序主体是CSDN下载b样条拟合,在些基础修改和完美。(无分确需要的可电邮:zglore#163.com)

资源截图

代码片段和文件信息

#include “Bspline_fitting.h“
#include 
#include 

#include 
#include 
#include 

using namespace std;




double Bspline_fitting::OneBasicFuns(int pint mdouble U[]int idouble u)
{
// 此函数算法见<>  P74
double N[30];
double savedtemp;
int jk;
double UleftUright;
if( ((i==0) && (u==U[0])) || ((i==m-p-1) && (u==U[m])) ) //special case
{
return(1.0);
}
if(u=U[i+p+1])  // local property
{
return (0);
}

for(j=0;j<=p;j++) // initialize zero‘th degree functions
{
if(u>=U[i+j] && u {
N[j]=1.0;  //Ni0=1.0
}
else
{
N[j]=0.0;
}
}

//computing the coefficients by de boor‘s algorithman efficient program

for(k=1;k<=p;k++)
{
if(N[0]==0.0)
{
saved=0.0;
}
else
{
saved=(u-U[i])*N[0]/(U[i+k]-U[i]);
//printf(“saved:\t%.9f\n“saved);
}
for(j=0;j {
Uleft=U[i+j+1];
Uright=U[i+j+k+1];
if(N[j+1]==0)
{
N[j]=saved;
saved=0.0;
}
else
{
temp=N[j+1]/(Uright-Uleft);
N[j]=saved+(Uright-u)*temp;
saved=(u-Uleft)*temp;
}
}
}


//an easy understunding way of de boor‘s algorithm   ;wrong program!
/*for(k=1;k<=p;k++)
{

for(j=0;j {

if(N[j]==0.0)
saved = 0.0;
else
saved = N[j]*(u-U[i])/(U[i+k]-U[i]);
if(N[j+1] == 0.0)
temp = 0.0;
else
temp = N[j+1]/(U[i+j+k+1]-U[i+j+1]);
printf(“savedtemp:\n%.9f%.9f“savedtemp);
N[j] = saved + temp*(U[i+j+k+1]-u);
}

}
*/
return(N[0]);
}


void Bspline_fitting::matric_multiple(double A[]double B[]int A1int A2int B1int B2double C[])
{
// 本程序计算矩阵C=A*B,A1,A2为B1,B2分别为矩阵A,B的行数和列数,其中A2必须与B1相等。
if(A2!=B1)
{
cout <<“number of columns of matric A must equal to the number of ranks of matric B“;
exit(0);
}
int ijkq=0;
double qq;
for(i=0;i {
for(k=0;k {
C[q]=0;
for(j=0;j {
C[q]=C[q]+A[i*A2+j]*B[j*B2+k];
qq=C[q];
}
q=q+1;
}
}
// 完毕
}


void Bspline_fitting::matric_transpose(double A[]int A1int A2double C[])
{
// 本程序计算矩阵的转置
int ijk=0;
for(i=0;i {
for(j=0;j {
C[k]=A[i+j*A2];
k=k+1;
}
}
//完毕
}


void Bspline_fitting::matric_plus(double A[]double B[]int A1int A2int B1int B2double C[])
{
if( (A1!=B1)||(A2!=B2))
{
cout << “Errors:the wrong input matrics !“;
exit(0);
}
int ijl=0;
for(i=0;i {
for(j=0;j {
C[l]=A[l]+B[l];
l=l+1;
}
}
}


void Bspline_fitting::matric_minus(double A[]double B[]int A1int A2int B1int B2double C[])
{
if( (A1!=B1)||(A2!=B2))
{
cout << “Errors:the wrong input matrics !“;
exit(0);
}
int ijl=0;
for(i=0;i {
for(j=0;j {
C[l]=A[l]-B[l];
l=l+1;
}
}
}


void Bspline_fitting::k_matr

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

     文件      16046  2010-08-13 17:32  Nurbs_fitting\Bspline_fitting.cpp

     文件      10181  2009-08-12 17:15  Nurbs_fitting\Bspline_fitting.cpp~RF1f39138.TMP

     文件      10177  2009-08-12 17:17  Nurbs_fitting\Bspline_fitting.cpp~RF1f61c77.TMP

     文件      15851  2010-08-13 16:29  Nurbs_fitting\Bspline_fitting.cpp~RF32f951.TMP

     文件      15877  2010-08-13 16:32  Nurbs_fitting\Bspline_fitting.cpp~RF423ab6.TMP

     文件      15899  2010-08-13 16:51  Nurbs_fitting\Bspline_fitting.cpp~RF463c29.TMP

     文件      15916  2010-08-13 16:54  Nurbs_fitting\Bspline_fitting.cpp~RF470ca8.TMP

     文件      10082  2009-08-11 15:59  Nurbs_fitting\Bspline_fitting.cpp~RF62a953.TMP

     文件      16046  2010-08-13 17:07  Nurbs_fitting\Bspline_fitting.cpp~RF66a0a4.TMP

     文件      10271  2009-08-11 17:18  Nurbs_fitting\Bspline_fitting.cpp~RFb74607.TMP

     文件       9854  2009-08-12 12:14  Nurbs_fitting\Bspline_fitting.cpp~RFdfea44.TMP

     文件       1194  2010-08-13 16:28  Nurbs_fitting\Bspline_fitting.h

     文件        724  2010-08-13 17:10  Nurbs_fitting\Bspline_main.cpp

     文件        638  2009-08-12 14:20  Nurbs_fitting\Bspline_main.cpp~RF167347b.TMP

     文件       3615  2009-01-04 09:19  Nurbs_fitting\Bspline_main.dsp

     文件        549  2009-01-04 09:19  Nurbs_fitting\Bspline_main.dsw

     文件    1076224  2010-08-14 09:56  Nurbs_fitting\Bspline_main.ncb

     文件      48640  2009-01-04 09:19  Nurbs_fitting\Bspline_main.opt

     文件       1226  2009-01-04 08:56  Nurbs_fitting\Bspline_main.plg

     文件        888  2009-08-11 11:10  Nurbs_fitting\Bspline_main.sln

    ..A..H.     14336  2010-08-14 09:56  Nurbs_fitting\Bspline_main.suo

     文件       5306  2009-08-11 17:02  Nurbs_fitting\Bspline_main.vcproj

     文件       1427  2010-08-14 09:56  Nurbs_fitting\Bspline_main.vcproj.BAF1818988F64F9.Administrator.user

     文件      11010  2010-08-13 17:32  Nurbs_fitting\B_spline.txt

     文件     630131  2010-08-13 17:32  Nurbs_fitting\Debug\Bspline_fitting.obj

     文件     622378  2009-08-12 17:22  Nurbs_fitting\Debug\bspline_fitting.obj.enc

     文件     712704  2010-08-13 17:32  Nurbs_fitting\Debug\Bspline_main.exe

     文件        146  2010-08-13 17:01  Nurbs_fitting\Debug\Bspline_main.exe.embed.manifest

     文件        212  2010-08-13 17:01  Nurbs_fitting\Debug\Bspline_main.exe.embed.manifest.res

     文件        145  2010-08-13 17:32  Nurbs_fitting\Debug\Bspline_main.exe.intermediate.manifest

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

评论

共有 条评论

相关资源