bspline

b-splines for drawing, not predicting, based on control path

坚强是说给别人听的谎言 提交于 2019-12-14 01:58:47
问题 I've tried to approach my general problem through two separate questions here on SO: Specify clamped knot vector in bs-call and Fit a B spline to a control path. The responses to these have led me to a reformulation of the bigger problem, which I'm now posting. What I'm trying to accomplish is (in R), given a set of (non-monotonous) control points, how do I draw a b-spline along the path given by the control points. The b-spline must be clamped in both ends. This is purely for graphical

Cubic spline method for longitudinal series data?

早过忘川 提交于 2019-12-12 08:02:15
问题 I have a serial data formatted as follows: time milk Animal_ID 30 25.6 1 31 27.2 1 32 24.4 1 33 17.4 1 34 33.6 1 35 25.4 1 33 29.4 2 34 25.4 2 35 24.7 2 36 27.4 2 37 22.4 2 80 24.6 3 81 24.5 3 82 23.5 3 83 25.5 3 84 24.4 3 85 23.4 3 . . . Generally, 300 animals have records of milk in different time points of short period. However, if we join their data together and do not care about different animal_ID, we would have a curve between milk~time like this, the line in figure below: Also, in the

BSpline derivativeAt() method does not return correct value

会有一股神秘感。 提交于 2019-12-12 01:38:12
问题 I am having problems with the derivativeAt() method when using the BSpline path because it is not returning the correct values, however the derivativeAt() method works find for the CatmullRomSpline path so this is something specific to SPline. The wiki and API do not mention that the SPline needs to be treated differently from other paths...is there something that I’m missing with SPline, or is this a bug with LibGDX? I made a simple program to show the problem. It draws the control points

interpret result of scipy.interpolate spline fit

早过忘川 提交于 2019-12-11 09:06:05
问题 I have some data points which I like to approximate with a cubic b-spline fit. In an other program, I like to interpolate some points using only the fitted knots and coefficients. This means that I need to write the code to evaluate a point given the knots and coefficients myself. Using this wiki page, I was already able to evaluate various points correctly with the result of knots,coeff,n=scipy.interpolate.splrep(x,y) Strangely, I needed to remove the first and last 3 entries in the arrays

B-spline fitting to 2D discrete data points (pixels of contour image)

断了今生、忘了曾经 提交于 2019-12-10 18:08:00
问题 I am trying to fit a B-spline to a set of ordered discrete data points which represent pixels of a contour extracted from an image. While the below code works fine for some simple shapes, but not for others (please see attached image for examples). Why does this happen, and what would be a better way to approach this problem? I am quite new to differential geometry, appreciate any insights or inputs. Thanks. % data contains two columns representing x,y coordinates of pixels x = data(:, 1); y

Fitting data to a B-spline in MATLAB

南楼画角 提交于 2019-12-06 10:29:22
问题 I am trying to estimate missing values in time-series data which is in the form of a matrix. The columns represent the time points,i.e. Now, I want to fit each row of the matrix to a B-Spline, and use it to estimate the missing values. I could fit the data to a normal spline using MATLAB, but I am completely stuck at trying to figure out how to fit the data to create a B-Spline. Using the default bspline function in the Curve Fitting Toolbox lets me set the knot vector to the vector of time

B-spline curves

橙三吉。 提交于 2019-12-06 08:38:34
问题 I have a set of points which I want to smooth using B-spline curves. My question is how can I implement B-spline curves to smooth these set of points? I want to implement this using c++. 回答1: Here is a function for any given number of points: void Spline(double x[N+1],double y[N+1], // input double A[N],double B[N], // output double C[N],double D[N]) // output { double w[N]; double h[N]; double ftt[N+1]; for (int i=0; i<N; i++) { w[i] = (x[i+1]-x[i]); h[i] = (y[i+1]-y[i])/w[i]; } ftt[0] = 0;

Fitting data to a B-spline in MATLAB

好久不见. 提交于 2019-12-04 17:06:30
I am trying to estimate missing values in time-series data which is in the form of a matrix. The columns represent the time points,i.e. Now, I want to fit each row of the matrix to a B-Spline, and use it to estimate the missing values. I could fit the data to a normal spline using MATLAB, but I am completely stuck at trying to figure out how to fit the data to create a B-Spline. Using the default bspline function in the Curve Fitting Toolbox lets me set the knot vector to the vector of time points, but I cannot set the control points, i.e. the elements of the row. Any help would be much

B-spline curves

心已入冬 提交于 2019-12-04 13:35:21
I have a set of points which I want to smooth using B-spline curves. My question is how can I implement B-spline curves to smooth these set of points? I want to implement this using c++. Here is a function for any given number of points: void Spline(double x[N+1],double y[N+1], // input double A[N],double B[N], // output double C[N],double D[N]) // output { double w[N]; double h[N]; double ftt[N+1]; for (int i=0; i<N; i++) { w[i] = (x[i+1]-x[i]); h[i] = (y[i+1]-y[i])/w[i]; } ftt[0] = 0; for (int i=0; i<N-1; i++) ftt[i+1] = 3*(h[i+1]-h[i])/(w[i+1]+w[i]); ftt[N] = 0; for (int i=0; i<N; i++) { A

interpretation of the output of R function bs() (B-spline basis matrix)

寵の児 提交于 2019-12-03 07:39:58
问题 I often use B-splines for regression. Up to now I've never needed to understand the output of bs in detail: I would just choose the model I was interested in, and fit it with lm . However, I now need to reproduce a b-spline model in an external (non-R) code. So, what's the meaning of the matrix generated by bs ? Example: x <- c(0.0, 11.0, 17.9, 49.3, 77.4) bs(x, df = 3, degree = 1) # generate degree 1 (linear) B-splines with 2 internal knots # 1 2 3 # [1,] 0.0000000 0.0000000 0.0000000 # [2,]