1
$\begingroup$

I would like to fit some data points that I know look somehow like a deformed ellipse. I would like to fit them with a spline but also adding something like a soft constraint that it should also look like an ellipse (or any shape I like). What are names for techniques for doing this or relevant papers?

$\endgroup$
4
  • 1
    $\begingroup$ You could try to minimize an energy of the form $$E(s) = \int_0^{\ell} \|s(t) - f(t)\|^2_2 \, dt + \lambda \sum_{j=1}^{m} \|s(t) - p_j\|^2_2,$$ where $f:[0,\ell]\to \mathbb{R}^n$ arc-length parametrizes the curve you wish to be close to (e.g. the ellipse), $p_k\in\mathbb{R}^n$ are the points, and $s$ is a parametrization of the spline. The only issue I see is making this somehow parametrization independent. $\endgroup$
    – lightxbulb
    Commented Oct 25 at 9:53
  • 1
    $\begingroup$ For closed curves, polar coordinates might be a good option for the parameterization, no? $\endgroup$
    – nicoguaro
    Commented Oct 25 at 13:45
  • 1
    $\begingroup$ Making your curve look like a specific shape is maybe not so justifiable, but you could enforce smoothness by a sort of variational problem of the form $$E(s) = \sum_{j=1}^m \|s(t_j) - p_j\|_2^2 + \lambda\int_0^1 \|s'(t)\|_2^2~dt.$$ I think you can just set $t_j$ to some uniform spacing to enforce the order of the points and make the problem more well-posed. Increasing $\lambda$ will increase the smoothness of the resulting solution $\endgroup$
    – whpowell96
    Commented Oct 25 at 16:09
  • 1
    $\begingroup$ @whpowell96's suggestion produces a smoothing spline. As an extreme case if you choose $\|s''(t)\|$ and enforce interpolation through $p_j$ you get a cubic interpolating spline. You could vary the smoothness through the derivative order $\alpha > 0$ in $\|s^{\alpha}(t)\|$. $\endgroup$
    – lightxbulb
    Commented Oct 25 at 16:42

2 Answers 2

2
$\begingroup$

The usual way to make this happen is to cap the rate of change of the derivative (capping the second derivative / acceleration).

Assuming OLS for your fit, $s_i$ one element of your basis, the error term $\|\epsilon(\beta)\|_2^2 = \sum_i \epsilon_i(\beta)^2 $ then, your problem becomes:

\begin{aligned} \min_{\beta} \quad & \|\epsilon(\beta)\|^2_2\\ \textrm{s.t.} \quad & \|s''\|_2^2 <M \\ \end{aligned}

Which is equivalent for a given $\lambda$: $$ \min_{\beta} \|\epsilon(\beta)\|^2_2 + \lambda \|s''\|_2^2 $$

$\endgroup$
0
$\begingroup$

I think the Catmull-Rom splines could be what you are looking for. They are piecewise interpolatory splines.

The principal advantage of Catmull-Rom splines is that the points along the original set of points also make up the control points for the spline curve. Two additional points are required on either end of the curve.

Here are some nice online animations of these splines:

The uniform Catmull–Rom implementation can produce loops and self-intersections, there are variations that can solve this issue.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.