Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如果NURBS曲线的控制点已知,如何查找节点向量?_Python_Curve Fitting_Bspline_Nurbs_Basis - Fatal编程技术网

Python 如果NURBS曲线的控制点已知,如何查找节点向量?

Python 如果NURBS曲线的控制点已知,如何查找节点向量?,python,curve-fitting,bspline,nurbs,basis,Python,Curve Fitting,Bspline,Nurbs,Basis,我有一套控制点 pts = [[849, 1181], [916, 1257], [993, 1305], [1082,1270], [1137,1181], [1118,1055], [993,1034], [873,1061], [849, 1181]] 我有生成开放结向量的逻辑: /* Subroutine to generate a B-spline open kno

我有一套控制点

pts = [[849, 1181],
       [916, 1257],
       [993, 1305],
       [1082,1270], 
       [1137,1181],
       [1118,1055], 
       [993,1034], 
       [873,1061], 
       [849, 1181]]
我有生成开放结向量的逻辑:

/*
Subroutine to generate a B-spline open knot vector with multiplicity
equal to the order at the ends.

c            = order of the basis function
n            = the number of defining polygon vertices
nplus2       = index of x() for the first occurence of the maximum knot       vector value
nplusc       = maximum value of the knot vector -- $n + c$
x()          = array containing the knot vector
*/

knot(n,c,x)

int n,c;
int x[];

{
    int nplusc,nplus2,i;
nplusc = n + c;
nplus2 = n + 2;

x[1] = 0;
    for (i = 2; i <= nplusc; i++){
        if ( (i > c) && (i < nplus2) )
            x[i] = x[i-1] + 1;
    else
            x[i] = x[i-1];


    }
}
/*  Subroutine to generate a B-spline uniform (periodic) knot vector.

c            = order of the basis function
n            = the number of defining polygon vertices
nplus2       = index of x() for the first occurence of the maximum knot vector value
nplusc       = maximum value of the knot vector -- $n + c$
x[]          = array containing the knot vector
*/

#include    <stdio.h>

knotu(n,c,x)

int n,c;
int x[];

{
    int nplusc,nplus2,i;

nplusc = n + c;
nplus2 = n + 2;

x[1] = 0;
for (i = 2; i <= nplusc; i++){
    x[i] = i-1;
}
}
/*
生成具有多重性的B样条开结向量的子例程
等于两端的顺序。
c=基函数的阶数
n=定义多边形顶点的数目
nplus2=第一次出现最大结向量值的x()索引
npluc=结向量的最大值--$n+c$
x()=包含结向量的数组
*/
结(n、c、x)
int n,c;
int x[];
{
int NPLUC,nplus2,i;
npluc=n+c;
nplus2=n+2;
x[1]=0;
对于(i=2;ic)和(i
另一个用于生成周期结向量:

/*
Subroutine to generate a B-spline open knot vector with multiplicity
equal to the order at the ends.

c            = order of the basis function
n            = the number of defining polygon vertices
nplus2       = index of x() for the first occurence of the maximum knot       vector value
nplusc       = maximum value of the knot vector -- $n + c$
x()          = array containing the knot vector
*/

knot(n,c,x)

int n,c;
int x[];

{
    int nplusc,nplus2,i;
nplusc = n + c;
nplus2 = n + 2;

x[1] = 0;
    for (i = 2; i <= nplusc; i++){
        if ( (i > c) && (i < nplus2) )
            x[i] = x[i-1] + 1;
    else
            x[i] = x[i-1];


    }
}
/*  Subroutine to generate a B-spline uniform (periodic) knot vector.

c            = order of the basis function
n            = the number of defining polygon vertices
nplus2       = index of x() for the first occurence of the maximum knot vector value
nplusc       = maximum value of the knot vector -- $n + c$
x[]          = array containing the knot vector
*/

#include    <stdio.h>

knotu(n,c,x)

int n,c;
int x[];

{
    int nplusc,nplus2,i;

nplusc = n + c;
nplus2 = n + 2;

x[1] = 0;
for (i = 2; i <= nplusc; i++){
    x[i] = i-1;
}
}
生成B样条均匀(周期性)结向量的子例程。 c=基函数的阶数 n=定义多边形顶点的数目 nplus2=第一次出现最大结向量值的x()索引 npluc=结向量的最大值--$n+c$ x[]=包含结向量的数组 */ #包括 纽图(北、中、西) int n,c; int x[]; { int NPLUC,nplus2,i; npluc=n+c; nplus2=n+2; x[1]=0; 对于(i=2;i节点向量(均匀与否)是NURBS曲线定义的一部分。因此,只要节点向量遵循以下基本规则,您就可以实际定义自己的非均匀节点向量:

1) #节点值=#控制点+顺序 2) 所有节点值必须是非递减的,即k[i]