# Non-symmetrical lemniscate curve parameterization

I'm trying to fit a function to data points. The data generally resembles a butterfly/lemniscate shape, see drawing.

The problem is that the shape in my data can be rotated, skewed and/or non-symmetrical.

I've been looking at Bernoulli's, Devil's curve, Watt's curve, however, these are, as far as I can see, symmetrical.

Does anyone know of a plane curve that is able to represent the example shapes? Preferably in Cartesian coordinates.

• Happy new year, and a reminder that your question and its answers requiring some action (votes, acceptance) Dec 31, 2016 at 16:16

There is a polar asymmetric modelling for the lemniscate:

which you can rotate and scale more easily that in Cartesian coordinates (but easy to convert). Such parameterizations are used very often as they can be less troublesome to fit.

Similar curves in astronomy are also called analemmas:

.

From an image processing fit point of view, you can consult: A Unified Scheme for Detecting Fundamental Curves in Binary Edge Images, Asano, Tetsuo et al., Computational Geometry, 2001

Why don't you use splines ? Bezier or Catmull Rom splines are just some examples that would approximate such curves. For a general approximation and conversion between them, you could check out the following paper:

A Novel Method for Vectorization, Tolga Birdal and Emrah Bala, Arxiv 1403.0728 https://arxiv.org/pdf/1403.0728v1.pdf

Another thing you can try is an active contour.

This is basically a curve that is defined by a number of points and iteratively optimised to "match" the shape of some image feature.

The procedure that optimises the location of the points is driven by two opposing "forces". One force is responsible for advancing the curve and one force is responsible for inhibiting it. For example, at each iteration, repelling forces may be assigned on the points that make them want to move away from each other, but, at the same time, another set of repelling forces could be established, this time away from identified edges on an image.

It's a bit easier to imagine how this works in 3 dimensions if you think of a balloon inside an object which you inflate and its surface, gradually, takes the shape of the space it is enclosed in. Similarly, you can think of a balloon that is over-inflated around an object and it is gradually deflated and traces the surface of the object it envelopes.

In this particular case and since the lemniscate is mostly convex, perhaps the "deflating" active contour will work best. You can find the bounding box by tracing the extrema of the curve as it is traced by the data and use the diagonal and centre of the bounding box to place an active "circle" around the curve which will eventually trace it.

Hope this helps.