For faster navigation, this Iframe is preloading the Wikiwand page for B样条.

B样条

数学的子学科数值分析裡,B-样条样条曲线一种特殊的表示形式。它是B-样条基曲线的线性组合。B-样条是貝茲曲線的一种一般化,可以进一步推广为非均匀有理B样条(NURBS),使得我们能给更多一般的几何体建造精确的模型。

De Boor算法是一个数值上稳定的计算B样条的方法。

术语 B样条是Isaac Jacob Schoenberg创造的,B 是基(basis)样条的缩略。

定义

[编辑]

给定m+1 个节点ti ,分布在[0,1]区间,满足

一个nB样条是一个参数曲线

它由nB样条基(basis B-spline)组成

.

Pi称为控制点de Boor点. m+1个n次B样条基可以用Cox-de Boor递归公式 定义

当节点等距,称B样条为均匀(uniform)否则为非均匀(non-uniform)。

均匀B样条曲线

[编辑]

当B样条是均匀的时候,对于给定的n,每个B样条基是其他基的平移拷贝而已。一个可以作为替代的非递归定义是

满足

满足

其中

是截断幂函数(truncated power function)

注解

[编辑]

当节点数和多项式次数相等时,B样条退化为貝茲曲線。即函数的形状由节点的位置决定。缩放或者平移节点向量不会改变基函数。

样条包含在它的控制点的凸包

n次B样条的一个基

仅当在区间[ti, ti+n+1]上非0。就是

换句话说,如果我们操作一个控制点,我们只改变曲线在局部的行为,而不像Bezier曲线那样是全局行为。

例子

[编辑]

常数B样条

[编辑]

常数B样条是最简单的样条。只定义在一个节点距离上,而且不是节点的函数。它只是不同节点段(knot span)的指示函数

线性B样条

[编辑]

线性B样条定义在两个相邻的节点段上,在节点连续但不可微。

三次B样条

[编辑]

一个片断上的B样条的表达式可以写作:

其中Si是第i个B样条片断而P是一个控制点集,ik是局部控制点索引。控制点的集合会是的集合,其中是比重,当它增加时曲线会被拉向控制点,在减小时则把曲线远离该点。


片段的整个集合m-2条曲线()由m+1个控制点()定义,作为t上的一个B样条可以定义为

其中i是控制点数,t是取节点值的全局参数。这个表达式把B样条表示为B样条基函数的线性组合,这也是这个名称的原因。

有两类B样条-均匀和非均匀。非均匀B样条相邻控制点间的距离不一定要相等。一个一般的形式是区间随着插入控制点逐步变小到0。


B樣條的程式指令

[编辑]

Matlab

[编辑]

In Matlab,the command“spline” can be used for spline interpolation.

(Note: In the command, the cubic B-spline is used)


Cubic B-Spline Interpolation by Matlab

Generating a sine-like spline curve and samples it over a finer mesh:

x = 0:1:10; % original sampling points

y = sin(x);

xx = 0:0.1:10; % new sampling points

yy = spline(x,y,xx);

plot(x,y,'o',xx,yy)

Python

[编辑]

事前安裝模組

  • pip install numpy
  • pip install scipy
  • pip install matplotlib


Cubic B-Spline Interpolation by Python

from scipy.interpolate import interp1d

import matplotlib.pyplot as plt

import numpy as np

x = np.arange(0, 11) # original sample points, [0, 1, 2, …, 9, 10]

y = np.sin(x)

f = interp1d(x, y, kind=' cubic ') ) # Cubic means the cubic B-spline.

x_new = np.arange(0, 10.1, 0.1) # new sample points, [0, 0.1, 0.2, ….., 9.9, 10]

y_new = f(x_new)

plt.plot(x,y,'o',x_new, y_new)

plt.show()


B样条曲面

[编辑]

B样条曲线及曲面相关算法

[编辑]

关于此处涉及的算法,在著作[1]中有针对Bézier、B样条(B-spline)以及非均匀有理B样条(Nurbs)的相关算法的详细数学表达和程序实现方法。

求导

[编辑]

在几何处理中,对参数曲线及曲面的求导是最基本的运算之一,由于参数表达的特性,在给定点的切线及法线可通过求导直接得到。 先来考察曲线的情形:采用本页定义中的B样条曲线表达式 对参数进行求导:

节点插入与删除

[编辑]

曲线及曲面拟合

[编辑]

应用

[编辑]

参看

[编辑]

参考

[编辑]

本條目部分或全部内容出自以GFDL授權發佈的《自由線上電腦詞典》(FOLDOC)。

  1. ^ Les Piegl and Wayne Tiller: The NURBS Book, Springer-Verlag 1995-1997 (2nd ed).

參考文獻

[编辑]
  • Jian-Jiun Ding, “Time Frequency Analysis and Wavelet Transforms ”, NTU, 2021.


外部链接

[编辑]
{{bottomLinkPreText}} {{bottomLinkText}}
B样条
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?