I made this implementation of the BSPLINE curve. I Followed the usual definition presented in http://en.wikipedia.org/wiki/B-spline t is the knot vector. #include <stdio.h> double N(int i, int k, double u, double t[]) { if(k == 1) { if(u >= t[i] && u < t[i+1]) return 1.0e0; else { return 0.0e0;...

I want to perform a (cubic) spline interpolation for population data to "transform" yearly data into quarterly data. I know that there are a fair number of flaws doing so, but I need to do it. Here is an example of my code (using generic input data): #--------------spline interpolation x...

I am trying to use na.spline, part of the zoo package, to replace NA values in some imported speed data with a cubic spline interpolated values. na.spline is modifying the NA values as it is supposed to; however, it is also modifying values that originally equaled 0. ex <- data.frame(speed)...

I have the following curve (example data that's somewhat sparse, but should get the point across). There are four points along this curve (indicated by the arrows), that I'd like to use as reference points. These points need to be shifted by specified amounts (x1, x2, x3, and x4 respectively)...

I'm using LibGDX for my Android app. I need to move and orient 3D object(ModelInstance) along a spline.In my case it's CatmullRomSpline. I got the movement working but having problem with orienting the ModelInstance along the spline. My Code: public void update() { float t = SPEED * Gdx.graphics.getDeltaTime(); elapsedTime...

I am actually attempting to write code for the cubic spline interpolation. Cubic spline boils down to a series of n-1 segments where n is the number of original coordinates given initially and the segments are each represented by some cubic function. I have figured out how to get all...

Suppose I want to approximate a half-cosine curve in SVG using bezier paths. The half cosine should look like this: and runs from [x0,y0] (the left-hand control point) to [x1,y1] (the right-hand one). How can I find an acceptable set of coefficients for a good approximation of this function? Bonus...

I'm trying to prepare some demographic data retrieved from Eurostat for further processing, amongst others replacing any missing data with corresponding approximated ones. First I was using data.frames only, but then I got convinced that data.tables might offer some advantages over regular data.frames, so I migrated to data.tables. One thing...

I'm trying to do something like the following (image extracted from wikipedia) #!/usr/bin/env python from scipy import interpolate import numpy as np import matplotlib.pyplot as plt # sampling x = np.linspace(0, 10, 10) y = np.sin(x) # spline trough all the sampled points tck = interpolate.splrep(x, y) x2 = np.linspace(0,...