###### 曲线平滑-B样条曲线

3D空间曲线三次B样条平滑示例：

struct D_DOT3D //D_DOT3D示例，未完全实现
{
double x,y,z;
}

double GetThreeBSplineValue(double p0, double p1, double p2, double p3, double t)
{
double A0 = (p0 + 4*p1 + p2) / 6;
double A1 = - (p0 - p2)/2;
double A2 = (p0 - 2*p1 + p2) / 2;
double A3 = - (p0 - 3*p1 + 3*p2 - p3)/6;
return A0 + A1 * t + A2 * t*t + A3 * t*t*t;
}

D_DOT3D GetThreeBSplineValue(D_DOT3D p0, D_DOT3D p1, D_DOT3D p2, D_DOT3D p3 , double t)
{
D_DOT3D dot;
dot.x = GetThreeBSplineValue(p0.x, p1.x, p2.x, p3.x, t);
dot.y = GetThreeBSplineValue(p0.y, p1.y, p2.y, p3.y, t);
dot.z = GetThreeBSplineValue(p0.z, p1.z, p2.z, p3.z, t);

return dot;
}

long ThreeBSplineCurve( vector<D_DOT3D> &line )
{
if (line.size()<4)
return 0;

vector<D_DOT3D> vout;
for (int i=0; i<line.size()-3; ++i)
{
D_DOT3D p0(line[i]);
D_DOT3D p1(line[i+1]);
D_DOT3D p2(line[i+2]);
D_DOT3D p3(line[i+3]);
if(0 == i)
{
D_DOT3D dot1 = GetThreeBSplineValue(p0, p1, p2, p3, 0.0);
vout.push_back(dot1);
}

D_DOT3D dot2 = GetThreeBSplineValue(p0, p1, p2, p3, 1/3.0);
D_DOT3D dot3 = GetThreeBSplineValue(p0, p1, p2, p3, 2/3.0);
D_DOT3D dot4 = GetThreeBSplineValue(p0, p1, p2, p3, 1.0);

vout.push_back(dot2);
vout.push_back(dot3);
vout.push_back(dot4);
}

line = vout;

return 1;
}


#### b-spline学习-系数计算及程序实践

2016-12-31 15:19:33

#### B样条曲线

2012-06-30 06:43:00

#### B-spline Curves 学习之B样条曲线定义（4）

2016-08-24 17:39:04

#### Spline算法实现

2016-01-21 16:45:09

#### B-样条曲线教程（B-spline Curves Notes）目录

2009-10-30 20:50:00

#### B-spline曲线详解

2012年03月09日 159KB 下载

#### B-样条曲线：定义

2010-03-10 22:31:00

#### B-spline Curves 学习之B样条曲线性质（5）

2016-08-24 17:40:09

#### B-样条曲线：闭曲线

2010-03-16 17:17:00

#### 课堂笔记_ B样条曲线和NUBRS

2017-05-08 23:21:00