bspline

Create BSpline from knots and coefficients

不想你离开。 提交于 2021-01-27 18:14:39
问题 How can a spline be created if only the points and the coefficients are known? I'm using scipy.interpolate.BSpline here, but am open to other standard packages as well. So basically I want to be able to give someone just those short arrays of coefficients for them to be able to recreate the fit to the data. See the failed red-dashed curve below. import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import BSpline, LSQUnivariateSpline x = np.linspace(0, 10, 50) # x-data y =

How to combine Rational B-spline Surfaces?

对着背影说爱祢 提交于 2020-07-23 06:43:25
问题 How to combine Rational B-spline Surfaces into one or fewer? How do metrics such as tolerance, u/v degree, u/v span influence the final result, if any? 回答1: In general, there is no way to create a single rational B-spline surface as the exact merge result of the 4 input rational B-spline surfaces. So, you will have to settle with an approximation. Consequently, there is no need for this approximating surface to be rational. The approximation schemes typically are divided into two categories:

How to combine Rational B-spline Surfaces?

元气小坏坏 提交于 2020-07-23 06:42:27
问题 How to combine Rational B-spline Surfaces into one or fewer? How do metrics such as tolerance, u/v degree, u/v span influence the final result, if any? 回答1: In general, there is no way to create a single rational B-spline surface as the exact merge result of the 4 input rational B-spline surfaces. So, you will have to settle with an approximation. Consequently, there is no need for this approximating surface to be rational. The approximation schemes typically are divided into two categories:

How to combine Rational B-spline Surfaces?

╄→尐↘猪︶ㄣ 提交于 2020-07-23 06:40:55
问题 How to combine Rational B-spline Surfaces into one or fewer? How do metrics such as tolerance, u/v degree, u/v span influence the final result, if any? 回答1: In general, there is no way to create a single rational B-spline surface as the exact merge result of the 4 input rational B-spline surfaces. So, you will have to settle with an approximation. Consequently, there is no need for this approximating surface to be rational. The approximation schemes typically are divided into two categories:

How to reconstruct a B-spline surface's 4 sides to 4 B-spline curves?

為{幸葍}努か 提交于 2020-05-30 08:37:39
问题 How to reconstruct a B-spline surface's 4 sides to 4 B-spline curves? ps: It should be similar to Autodesk Alias's Duplicate Curve Tool, where you can select any U/V on a surface and rebuild a degree 3 B-spline curve. I don't know what's the algorithm behind. 回答1: The 4 boundary curves of a B-spline surface can be constructed easily as B-spline curves by using the first/last row or column of control points and corresponding degree and knot vectors. For example, the boundary curve in u

Formula to calculate the control point from three known points on a D3 “basis” curve

醉酒当歌 提交于 2020-01-15 12:30:24
问题 I have a curve generated by a D3.js line generating function with interpolate set as "basis". The problem is that the line generated only touches the first and last point given into the line generating function and does not pass through the ones in between. I am aware that these are treated as control points to generate the b-spline curve, but what I am looking for is a way to "project"/calculate the control points so that the curve does go through every point in my path array. These in

Approximate a shape outline using constrained B-splines

↘锁芯ラ 提交于 2019-12-24 00:59:03
问题 I'm looking for a possibility to generate a constrained spline in order to approximate a shape (in my case, a footprint outline). As raw data, I have a table with several hundred xy-coordinate pairs, which have been collected from the boundary of the footprint. The spline should only approximate the data points (the spline does not need to pass the data points). I want to be able to smooth the spline to certain degrees. Also, I need to be able to constrain the spline: Defining several

B-spline interpolation with Python

邮差的信 提交于 2019-12-20 09:20:12
问题 I am trying to reproduce a Mathematica example for a B-spline with Python. The code of the mathematica example reads pts = {{0, 0}, {0, 2}, {2, 3}, {4, 0}, {6, 3}, {8, 2}, {8, 0}}; Graphics[{BSplineCurve[pts, SplineKnots -> {0, 0, 0, 0, 2, 3, 4, 6, 6, 6, 6}], Green, Line[pts], Red, Point[pts]}] and produces what I expect. Now I try to do the same with Python/scipy: import numpy as np import matplotlib.pyplot as plt import scipy.interpolate as si points = np.array([[0, 0], [0, 2], [2, 3], [4,

Interactive BSpline fitting in Python

柔情痞子 提交于 2019-12-19 03:15:50
问题 Using the following function, one can fit a cubic spline on input points P: def plotCurve(P): pts = np.vstack([P, P[0]]) x, y = pts.T i = np.arange(len(pts)) interp_i = np.linspace(0, i.max(), 100000 * i.max()) xi = interp1d(i, x, kind='cubic')(interp_i) yi = interp1d(i, y, kind='cubic')(interp_i) fig, ax = plt.subplots() fig,ax=plt.subplots() ax.plot(xi, yi) ax.plot(x, y, 'ko') #plt.show() return xi,yi The input points P can be of the following form: P=[(921,1181),(951,1230),(993,1243),(1035

Fast b-spline algorithm with numpy/scipy

一个人想着一个人 提交于 2019-12-17 15:36:52
问题 I need to compute bspline curves in python. I looked into scipy.interpolate.splprep and a few other scipy modules but couldn't find anything that readily gave me what I needed. So i wrote my own module below. The code works fine, but it is slow (test function runs in 0.03s, which seems like a lot considering i'm only asking for 100 samples with 6 control vertices). Is there a way to simplify the code below with a few scipy module calls, which presumably would speed it up? And if not, what