We’re rewarding the question askers & reputations are being recalculated! Read more.

# Tag Info

35

These splines are usually drawn as Bézier curves. Specifically, since it is defined by four points, the curve is a cubic Bézier. $$\vec{x} = (1-t)^3\vec{P_0} + 3(1-t)^2t\vec{P_1} + 3(1-t)t^2\vec{P_2} + t^3\vec{P_3}$$ with \begin{align} \vec{P_0} &= (-60, 20),\\ \vec{P_1} &= (0, 20),\\ \vec{P_2} &= (0, -20),\\ \textrm{and}\ \vec{P_3} &= (60, -...

26

A cubic spline is just a string of cubic pieces joined together so that (usually) the joins are smooth. The argument values at which the joins occur are called "knots", and the collection of knots is called a "knot sequence" or "knot vector". Let's take the knot sequence to be fixed, for a while. Then the set of all cubic splines (with these given knots) ...

24

The main motivation for using splines instead of a single polynomial is to avoid the oscillations in high-degree interpolating polynomials that can occur between interpolation points. Cubic splines allow $C^2$ interpolants, which are important in applications such as computer-aided design. Here is an example of oscillations from this page:

20

You could try a sine or cosine wave. Taking the lower left corner as the origin, let $$y=20\cos\left(\frac {\pi x}{120}\right)+20$$ This can also be written as $$y=40\cos^2\left(\frac{\pi x}{240}\right)$$

18

Cubic splines are often used to plot the cutting lines followed by numerically-controlled milling machines. The machines' cutters are typically rotating drill points that are moved over the surface to be cut by horizontal and vertical actuators. Obviously the node values have to be the same so as to have a single contiguous line to cut, and the node first ...

16

First, let's understand parametric splines. Let's assume we already know how to find $y$ as a (spline) function of $x$. And suppose we have a sequence of 2D points $P_i = (x_i,y_i)$. First, we assign a parameter value $t_i$ to each point $P_i$. The usual way to do this is to use chord-lengths -- you choose the $t_i$ values such that $t_i - t_{i-1} = \|P_i - ... 16 Splines allow interpolation with local support: moving a control point affects only the region around the control point (where "region" can be defined precisely as a function of the order of the spline). This is in contrast to e.g. interpolation by a single polynomial, where a small change at one control point can cause a large change at an arbitrary ... 14 Most of the other responses will, outside the given range, be either: (a) cyclical (come back up & down repeatedly), or (b) diverge to +/- infinity at the limit (far away from the origin). If it's at all important that the tails have horizontal asymptotes in the limit, then you want some flavor of logistic function: $$f(x)= \frac{L}{1+e^{-k(x-x_0)}}$$ 12 A quadratic polynomial$y=ax^2+bx+c$has only three "degrees of freedom" ($a,b,c). Thus if you want your quadratic function to run through two points, you have already only one degree of freedom left. If you want to prescribe the slope at one of the two points, this already uses up the last degree of freedom, thus leaving no choice for the slope at the ... 12 One of the application of splines is the interpolation of discrete data. If you want to compute the gradient of the interpolated function, then smoothness is important because you want your function to be differentiable. 11 Assuming you mean \begin{align} y(0) &= 40 \\ y(120) &= 0 \\ \dot{y}(0) &= 0 \\ \dot{y}(120) &= 0 \end{align} then a simple cubic will do: $$y(x) = \frac{x^3}{21600} - \frac{x^2}{120} + 40$$ At rangex=0\dots120$, it looks like this: You can find these very easily. In general, a cubic curve is $$y(x) = C_3 x^3 + C_2 x^2 + C_1 x + C_0$$ ... 9 Well, actually, you can use quadratic splines for many purposes. They are used to design TrueType fonts, for example. To construct a quadratic spline, you proceed as follows. Suppose you have$n$data items to interpolate (maybe$n$points, or$n-2$points and 2 end derivatives). Then we need a spline with$n$control points (and therefore$n$degrees of ... 9 I assume origin is at middle of vertical y-axis line. Mathematica code and plot: Plot [ 20 Cos[ Pi x/120], {x, 0, 120}, AspectRatio -> 1/3, GridLines -> Automatic, PlotStyle -> Thick] $$y = 20 \cos \frac{\pi x}{120} ,\, (0<x<120).$$ 9 One classical application of cubic splines in particular and splines in general is track transition curves. Consider the train that travels the straight track with velocity$v$and enters a curve with the shape of quarter-of-circle arc with radius$R$: its acceleration instantly goes from$0$to$\frac{v^2}{R}$(pointed to the center of the curve). Such ... 8 A$C^2$piecewise Hermite interpolant and a cubic spline are one and the same! Remember what's done to derive the tridiagonal system: we require that at a joining point, the second left derivative and the second right derivative should be equal. To that end, consider the usual form of a cubic Hermite interpolant over the interval$(x_i,x_{i+1})$: $$y_i+... 7 A cubic curve can twist in space (i.e. it can be non-planar). A quadratic curve is just a parabola, so it's always planar. In real applications like graphic arts, engineering, manufacturing, nobody cares much about derivatives, they only care about curvature. And it's possible to get continuity of curvature without continuity of second derivatives (so-... 7 Splines only follow one particular parametric equation in a piecewise way. One absurd special case - a linear "spline" with C^0 continuity is just what you get by drawing straight lines between the vertices you're interpolating in sequence. Each line follows a single linear parametric equation, C^0 means no derivatives need to match at each join - only the ... 6 Expanding a little on what Arkamis said ... Some people would define a spline to be any piecewise polynomial function. For example, deBoor's book uses this definition, and it's one of the definitive works on the subject. With that definition, there is no difference between the two kinds of interpolation you mentioned, of course. Other people (like here) ... 6 For a curve to be continuous, the functions must be equal where the segments meet - f_i(x_i) = f_{i-1}(x_{i-1}). A first order - linear - spline may be continuous, but it won't be smooth unless the points are all collinear. If you want the curve to be smooth, then you need the slope of the curves - the first derivatives - to be equal, so f'_i(x_i) = f'_{... 5 In general, the cubic spines are piecewise cubic functions passing through the given points [edit: with continuous first and second derivative] with minimal curvature as measured by the second derivative. So either your question is about functions where the "true" geometric curvature is minimized. Or it is in contrast to spline interpolations where one ... 5 Splines as interpolating curves of minimal curvature For curves with moderate curvature, the second derivative is a good proxy for the real curvature (inverse of the curvature radius). A spline is the minimizer of the variational problem to interpolate a given set of points while minimizing the second derivative:$$ y=\mathop{\arg\min}_{u\in H^2([a,b])}\... 5 For a quadratic Bézier curve, you need the two endpoints as well as the middle control point (which is not part of the curve itself, while the two endpoints are). Your "algorithm" for splitting the curve into two halves actually only calculates the new endpoint in the middle, but does not provide any hints as to how the middle control points for the two ... 5 Using elementary functions, one that roughly approximates your diagram is$f(x)=-\frac{40}{\pi}\arctan(\frac{x}{10})+20$. It isn't a great fit, but a rough approximate. Using non-elementary functions, your plot looks really similar to a mirrored normal distribution cumulative curve, which is based on the error function and defined as$\mathbb{erf}(x)=\frac{...

5

It's a Bézier curve. (No, Unity does not have a copyright or patent on Bézier curves.) Cubic Bézier curves are widely used in the computer graphics industry to create smooth curves like this one. You give the two endpoints of the curve $P_0, P_3$ and two intermediate "control points" $P_1,P_2$ and it produces a smooth curve that is tangent to the line $... 4 In general, we can only recover$f$from$f'$up to a constant summand, the famous constant of integration. For example,$x^3 + 2x + 4$and$x^3 + 2x - 5$have the same derivative,$3x^2 + 2$. Suppose we have a derivative of second degree$f' = ax^2 + bx + c$. Then,$f$could be any of$\frac{1}{3}ax^3 + \frac{1}{2}bx^2 + cx + d$, with$d \in \mathbb{R}$. So,... 4 A spline is a curve that is formed by stringing together polynomial pieces in a clever way (so that continuity between the pieces can be controlled). The polynomial pieces can have any degree. A common choice is degree = 3, in which case the spline is called a "cubic" spline. Any spline (of any degree) can be represented in b-spline form. From a ... 4 What you need is something called "Boehm's algorithm" (after its originator, Wolfgang Boehm). It has a simple geometric interpretation, and drawing a few pictures should make it clear. There is a pretty good explanation (with pictures) in this document. The algorithm is based on a process called "knot insertion". You keep inserting knots into the b-spline ... 4 The picture on the Wolfram web page is highly misleading. It could not be produced by the algorithm they describe (without some significant modifications -- see below). The spline they describe (which you implemented) gives$y$as a function of$x$. The algorithm relies on the fact that the input$x\$ values are strictly increasing. So, in your second and ...

4

This is the magic of b-splines. It's not too difficult to see if you examine the progression from degree zero (step functions) to degree one (hat functions). Take a linear combination of two step functions, with arbitrary coefficients, and write down the conditions that will need to be satisfied in order for the linear combination to be continuous. See ...

4

In general, a b-spline curve will not pass through any of its control points. There is an example at the bottom of this web page, which explains how repeating knot values will cause a b-spline curve to pass through one of its control points. This technique is typically used with the first and last knots, to force the spline to pass through the first and last ...

Only top voted, non community-wiki answers of a minimum length are eligible