3

I want to create a seam for an ellipse. (Mathematically I think this means that there are constant-length normal lines between the ellipse and the curve that creates the seam, but I'm not 100% sure that definition is accurate.) I know I can't do this by creating another ellipse with the axes reduced by the seam width because the distance between the two ellipses isn't constant. (i.e. in this image the green line is shorter than the two red lines.)

Offset ellipses

I can convert ellipses into cubic Beziers.

Ellipses as Beziers

Is there a way to calculate a modification to the control points of the inner Bezier to make the distance between the outer ellipse and inner Bezier constant?

SSteve
  • 133

3 Answers3

4

What you've described is typically called an "offset curve". The offset curve for an ellipse is ... not nice. The points of the ellipse itself satisfy a nice quadratic like $$ \frac{x^2}{a^2} + \frac{y^2}{b^2} = 1 $$ while those of the offset curve satisfy...a polynomial of degree 8 perhaps? I can't recall, but it's certainly not quadratic, hence not an ellipse (as you observe). But more important, it's also not described by a cubic spline, so that approach won't work either. I'm sorry to say that you just have to just do the calculus and work things out:

At the point $(x, y)$ of the ellipse above, a normal vector is $(\frac{2x}{a^2}, \frac{2y}{b^2})$, so the unit normal is $$ n(x, y) = \frac{1}{\sqrt{\frac{x^2}{a^4} + \frac{y^2}{b^4}}}(\frac{x}{a^2}, \frac{y}{b^2}) $$ and your offset curve is at location $$ (x, y) + s n(x, y), $$ where $s$ is the offset distance (positive for "larger than the original ellipse"; negative for "smaller than").

That only works for relatively small values of negative $s$; for larger negative numbers, you get "focal points" and things get messy.

John Hughes
  • 93,729
0

This falls under the subject of Parallel Curves. I've looked into this myself. If you are accustomed to working in the complex plane, I have found that for a curve $z$ in the complex plane, a parallel curve at a distance $d$ (inner or outer) is given very simply by the equation

$$z_d=z\pm i\ d\ \frac{\dot z}{|\dot z|}$$

The only problem I've had with this is when applying it in the vicinity of a cusp. It should work well for an ellipse.

Cye Waldman
  • 7,524
0

What you're looking for is a constant-distance offset curve or parallel curve.

Look at the answers to this question. The Tiller/Hanson algorithm gives a very simple way to construct an approximate offset of a Bezier curve. The approximation is not good enough for all purposes, but for an offset of an ellipse-like Bezier curve, it might be OK for you.

Or, for more theory, look at the references cited in the answers to this question.

bubba
  • 43,483
  • 3
  • 61
  • 122