3
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Making the distance between the outer ellipse and inner Bezier constant is impossible. $\endgroup$ – Jean Marie Feb 12 '19 at 23:56
  • $\begingroup$ Please refer to another question here. $\endgroup$ – Ng Chung Tak Feb 13 '19 at 10:51
4
$\begingroup$

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.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ It might be a bit easier to work with a parameterization of the ellipse. $\endgroup$ – amd Feb 12 '19 at 21:21
  • $\begingroup$ OK, so replace $x$ with $a \cos t$ and $y$ with $b \sin t$ everywhere in what I wrote above. $\endgroup$ – John Hughes Feb 12 '19 at 21:38
  • $\begingroup$ See core.ac.uk/download/pdf/52791186.pdf $\endgroup$ – Jean Marie Feb 12 '19 at 22:45
  • $\begingroup$ Also math.stackexchange.com/questions/2857088 $\endgroup$ – cgiovanardi Feb 14 '19 at 14:56
  • $\begingroup$ @JohnHughes Thanks. I was afraid of that but I figured I'd ask anyway. $\endgroup$ – SSteve Feb 15 '19 at 2:00
0
$\begingroup$

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.

| cite | improve this answer | |
$\endgroup$
0
$\begingroup$

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.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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