How do I transpose an ellipse function to stretch the ellipse into curved space?

2.5k Views Asked by At

I'm working on an engineering project, using CAD software.

I can write simple parametric functions to draw an ellipse, with $\theta$ ranging from $0$ to $2\pi$ radians:$$x=3.75\cos\theta$$$$y=1.25\sin\theta$$

But now I'm at a point where I need to bend the ellipse over a parabolic curve.
Here's a diagram demonstrating the curved space I'd like to bend/stretch my ellipse into.

Bent space diagram.

The white bottom-most curve is the parabolic curve, defined by the function:

$$y=-\frac{x(x+30)}{45}$$

The other two green curves are defined as parallel (equidistant) to the parabola at all points, matching the flat rectangles above.

As you can see from the diagram, the vertical minor axis for the ellipse becomes slanted, making the top of the ellipse "longer" than the bottom of the ellipse - which follows the stretching of the enclosing space.
But the ellipse should still touch the top and bottom of the slanted minor axis, as well as touching the left-hand end of the center green curve, which is the transformed major axis for the ellipse.

So the question is, how do I transpose my simple ellipse functions to stretch the ellipse into this curved space?

In your answers, feel free to place the origin wherever is most convenient for your solution. I'll have to translate the solutions anyway, to move them into their proper place in my engineering diagrams. :)

Edit: I've been asked whether polar coordinates would be acceptable, rather than Cartesian. My CAD software does support polar coordinates, so for anyone considering answering this question, feel free to build your answers with polar coordinates if that would make things easier for you.

8

There are 8 best solutions below

2
On BEST ANSWER

Others have mentioned that parameterizing a parabola by arc length is not possible with elementary functions. This is true, but it's not necessary.

First, we write the function for an ellipse centered at $(a,b)$ with semi-axes $a$ and $b$, respectively. $$\frac{(x-a)^2}{a^2} + \frac{(y-b)^2}{b^2} = 1$$ $$y = b \pm |b|\sqrt{1-\frac{(x-a)^2}{a^2}}.$$ Instead of $x$ and $y$, we want the perpendicular height above the parabola, $h$, in terms of the distance along the parabola, $s$. $$h = b \pm |b|\sqrt{1-\frac{(s-a)^2}{a^2}}.$$

The arc length of the parabola $y = kx^2$ as a function of $x$ is given by $$s(x) = \int_0^x\sqrt{1 + 4k^2x'^2}dx' = \frac{1}{2}x\sqrt{1+4k^2x^2} + \frac{1}{4k}\ln\left(\sqrt{1+4k^2x^2}+2kx\right).$$

Next, we need the unit vector perpendicular to the tangent of the parabola (kindly provided by @Wouter), $$\vec{n} = \frac{(-2kx, 1)}{\sqrt{4k^2 x^2 + 1}}.$$ This will allow us to parameterize the ellipse as $$(x_e, y_e) = (t, kt^2) + \vec{n}(t)h(t).$$ The first part $(t, kt^2)$, is a point on the parabola. Adding the second part $\vec{n}(t)h(t)$ results in a point on the upper or lower half of the ellipse. I've switched $x$ for $t$ for clarity. Even though $x(t) = t$ in the parabola, the corresponding $x$-coordinate on the ellipse will be different.

So, the transformed ellipse is parameterized by $$(x_e, y_e) = (t, kt^2) + \frac{(-2kt, 1)}{\sqrt{1+4k^2t^2}}\left(b \pm |b|\sqrt{1-\frac{(s(t)-a)^2}{a^2}}\right).$$

For the full ugliness, let's substitute in $s(x)$: $$(x_e, y_e) = (t, kt^2) + (-2kt, 1)\frac{1}{\sqrt{1+4k^2t^2}}\left(b \pm |b|\sqrt{1-\frac{\left(\frac{1}{2}t\sqrt{1+4k^2t^2} + \frac{1}{4k}\ln\left(\sqrt{1+4k^2t^2}+2kt\right)-a\right)^2}{a^2}}\right)$$ with $t \in [0, \text{~}7.4]$ The value 7.4 comes from a guess-and-check numerical approximation that solves for $t$ so that the part inside the parentheses is non-negative (i.e., $0 \leq s(t) \leq 2a$).

Slightly easier to read (maybe): $$x(t) = t + \frac{-2kt}{\sqrt{1+4k^2t^2}}\left(b \pm |b|\sqrt{1-\frac{\left(\frac{1}{2}t\sqrt{1+4k^2t^2} + \frac{1}{4k}\ln\left(\sqrt{1+4k^2t^2}+2kt\right)-a\right)^2}{a^2}}\right)$$

$$y(t) = kt^2 + \frac{1}{\sqrt{1+4k^2t^2}}\left(b \pm |b|\sqrt{1-\frac{\left(\frac{1}{2}t\sqrt{1+4k^2t^2} + \frac{1}{4k}\ln\left(\sqrt{1+4k^2t^2}+2kt\right)-a\right)^2}{a^2}}\right)$$

With $a = 3.75$, $b = 1.25$, and $k = -\frac{1}{45}$ (moving the vertex of the parabola to the origin), the graph looks like this: https://www.desmos.com/calculator/m8kxmdzbao

Parabolically transformed ellipse

12
On

My instinct says that this curved stretching is the wrong approach. Whatever answer you get will be useless for your CAD program.

Here's a plot of the curves and the unaltered ellipse: enter image description here

My method would be to use your CAD program to draw a line that is tangent to the lower half of the ellipse and the blue line, then use splines/Bézier curves to smooth the leftmost intersection between the upper half of the ellipse and the red line. Then you can discard the right part of the ellipse, leaving the lower quadratic curve, the left arc of the ellipse, and the upper red curve as your shape.

It ultimately doesn't matter what the actual equation is. All that matters is that the design can be manufactured. Referring to your previous question, I don't think the air flow is going to distinguish much between cosine, cubic Bézier, and quadratic curves.

0
On

Suppose your parabola is given by $$y=a x^2+b x + c$$ Its derivative is $y'=2 a x + b$. A vector perpendicular to your parabola at the point $(x,y)$ is thus $$(-2 a x - b,1)$$ Let us normalize this vector $$\vec{n}=\frac{(-2 a x - b,1)}{\sqrt{(2 a x + b)^2+1}}$$ The curves at distance $d$ from your parabola (green in your figure) are thus $$(x,a x^2+b x + c)+d\vec{n}$$ The above formula transforms cartesian-like coordinates $(x,d)$ into the transformed space $$T(x,d)=(x,a x^2+b x + c)+d\vec{n}$$ All we need to do is feed the ellipse expression to this transformation $$T(r_1\cos(\theta)+r_1,r_2\sin(\theta)+r_2)$$ this gives a curve with the desired characteristics.

Example: Transformed ellipse also showing transformed minor and major axis

This curve touches the straight lines at their midpoints. It also touces the top and bottom curve once, but not at their exact midpoint. If you want a curve that touches the bottom curves at its precise midpoint, you need to parametrize your parabola by its arc length, which is not possible in terms of elementary functions.

0
On

The map $$s\mapsto\left\{\eqalign{x_0(s)&:={\rm arsinh}\, s \cr y_0(s)&:=1-\sqrt{1+s^2}\cr}\right.\qquad(-\infty<s<\infty)$$ maps the $s$-axis isometrically onto the catenary $$\gamma:\qquad y=1-\cosh x=-{1\over2}x^2-{1\over24}x^4+?x^6\ ,$$ which is in the intended range a very good approximation to the parabola $y=-{1\over2}x^2$. One computes $$\dot x_0(s)={1\over\sqrt{1+s^2}},\qquad\dot y_0(s)=-{s\over\sqrt{1+s^2}}\ ,$$ confirming that $\dot x_0^2(s)+\dot y_0^2(s)\equiv1$. It follows that the map $$(s,t)\mapsto\left\{\eqalign{x(s,t)&:={\rm arsinh}\, s+{t s\over\sqrt{1+s^2}} \cr y(s,t)&:=1-\sqrt{1+s^2}+{t\over\sqrt{1+s^2}}\cr}\right.\qquad(-\infty<s<\infty, \ -h<t<h)\tag{1}$$ maps the horizontal strip $|t|<h$, $h>0$ sufficiently small, of the $(s,t)$-plane bijectively onto a curved strip along the catenary $\gamma$ in such a way that (i) the soul $t=0$ is mapped isometrically onto $\gamma,$ and (ii) vertical segments $t\mapsto (s_0,t)$ $(-h<t<h)$ are mapped isometrically onto vertical segments orthogonal to $\gamma$ at $\bigl(x_0(s_0),y_0(s_0)\bigr)\in\gamma$. In this way horizontal lines $s\mapsto(s, t_0)$ $(-\infty<s<\infty)$ are mapped onto parallel curves of $\gamma$ at distance $|t_0|$ from $\gamma$.

If you now are given a curve $$\theta\mapsto\bigl(s(\theta),t(\theta)\bigr)\qquad(0\leq\theta\leq\Theta)\tag{2}$$ in the $(s,t)$-plane, e.g., an ellipse, then you immediately obtain a parametric representation of its distorted image in the $(x,y)$-plane by composing the representation $(2)$ with $(1)$.

7
On

I'm not an engineer but suddenly I feel very attracted to your problem In the figure below, I've turned your drawing in order to clearly visualize it consistently with the function defining your parabola. I think your problem can be seen as "bend" the rectangle with sides 2.5 and 15 more than "bend" the ellipse. I'm wrong?

Whether you have in mind or do not have this view, the answer to the problem is to determine the arc of the (below) envelope of the family of circles of radius $r=2.5$ centered at a point $P(x,y)$ when this point passes through the curve from the point $(-15,-5)$ to the point $(-30,0)$. However the “nature” of this problem (bending a rectangle) is easy to describe in words or even draw but difficult or tedious to express analytically. I give here two methods to solve the problem leaving final calculations to calculators I do not have (it is possible but tedious without calculators).

(1) The envelope can be calculated by solving $$\begin{cases}F(X,Y,t)=0\\ \frac{\partial F(X,Y,t) }{\partial t}=0\end{cases}$$ where we parametrize the circles with the function $$F(X,Y,t)=(X-t)^2+(Y-\frac{t(t+30)}{45})^2-(2.5)^2=0$$ ►(1’) Furthermore, if the family of circles can be parameterized with “good” funtions, as it is our cases putting $$\begin{cases}X=t+\cos \theta\\Y=\frac{t(t+30)}{45}+\sin \theta\end{cases}$$ then we can solve $$\frac{\partial X}{\partial t}\frac{\partial Y}{\partial \theta}=\frac{\partial Y}{\partial t}\frac{\partial X}{\partial \theta}$$ This way we have (excepting error in calculation) the parametrics: $$\color{red}{\begin{cases}X=-\left(\frac{30\sin \theta+45\cos \theta}{2\sin \theta}\right)+\cos \theta\\45Y=\left(\frac{30\sin \theta+45\cos \theta}{2\sin \theta}\right)^2-30\left(\frac{30\sin \theta+45\cos \theta}{2\sin \theta}\right)+45\sin \theta\end{cases}}$$

(2) Because the searched parabola can be defined by $Y=aX^2+bX+c$ we can calculate the corresponding values of the coefficients $a,b,c$ by three (adequate) points $(X,Y)$ in three distinct normals to $y=\frac{x(x+30)}{45}$ such that $(X-x)^2+(Y-y)^2=(2.5)^2$.

We do that the following way:

i)Our three points $(x,y)$: $P_1=(0,0),P_2=(-15,-5),P_3=(-30,0)$. The corresponding point to $P_2$ is clearly $(X,Y)=(-15,-7.5)$.

ii) The normal at $P_1$ is $Y=-\frac 32 X$ and the required point $(X,Y)$ is such that $X^2+Y^2=(2.5)^2$ so we have $13X^2=25$ hence we get the second point $(X,Y)=(\frac{5\sqrt{13}}{13},-\frac{15\sqrt{13}}{26})$.

iii) Similarly the third point is $(X,Y)=(-\frac{390+5\sqrt{13}}{13},-\frac{15\sqrt{13}}{26})$.

iiii) We have now to solve the linear system $$\begin{cases}225a-15b+c=-7.5\\650a-65\sqrt{13}b+338c=-195\sqrt{13}\\2(11725+300\sqrt{13})a-2(390+5\sqrt{13})b+26c=-15\sqrt{13}\end{cases}$$ You can solve this (where it is not impossible there is a mistake in calculations). What is important is the method. I think this last one is the best but I am maybe wrong about it.

enter image description here

0
On

As others have noted, this is really just a deformation or change-of-coordinates problem. Our ellipse is defined in a rectangular cartesian coordinate system, and we want to map it to another system where coordinates are distance along the parabola and normal distance away from the parabola.

These kinds of deformations are common in high-end CAD systems. However, as @Wouter pointed out, the equation of the deformed ellipse is the composition of the original ellipse equation and the change-of-variables transformation, so it's an ugly thing that no CAD system can represent exactly (as far as I know). So, the CAD system will typically give you a spline approximation of the true deformed shape. This is perfectly OK, of course, as long as the approximation is more accurate than your manufacturing tolerances.

The picture below shows the result I got in my favorite CAD system.I didn't use the same numbers as you, but that doesn't matter. The point is to see what can be achieved with standard built-in functions in typical CAD systems.

enter image description here

More info in these answers.

0
On

A reasonable analytic expression for a distorted ellipse comes from using $y-g(x)$ instead of $y$ in the original equation, where $g(x)$ corresponds to the parabola. This represents an ellipse whose horizontal axis has been bent (and stretched) according to the curve $g(x)$, where the horizontal projection of the axis is preserved, not its length.

In this example $$\left(\frac{x-\frac{15}{4}}{\frac{15}{4}}\right)^2+\left(\frac{y-5+\frac{x^2}{45}}{\frac{5}{4}}\right)^2 = 1$$

leads to the following quartic.

$$\frac{16 x^4+1440 x^2 y-3600 x^2-27000 x+32400 y^2-324000 y+860625}{50625} = 1$$

Here is the [resulting graphic](http://www.wolframalpha.com/input/?i=((x-15%2F4)%2F(15%2F4))%5E2%2B((y-5%2Bx%5E2%2F45)%2F(5%2F4))%5E2%3D1+from+x%3D0+to+15,+y%3D0+to+7).

This might be related to the bean curve.

0
On

We are interested in the region $15\le x\le 22.5$ and $5\le y\le 7.5$.

Consider the given parabola $$y=-\frac 1{45}x(x-30)\\ \frac{dy}{dx}=-\frac1{45}(2x-30)$$ At $x=a$, slope of tangent is given by $$\tan\phi=-\frac 1{45}(2a-30)$$

For a point $(a,b)$ in the region of interest, to realise this "parabolic shear", the transformations required are:
(1) translational shift downwards by $-\frac{(a-15)^2}{45}$; followed by
(2) clockwise rotation of $\phi$ about $(a,-\frac{a(a-30)}{45})$
after going through both of which the resultant point is $$(a', b')=\left(a+(b-5)\sin\phi, -\frac{a(a-30)}{45}+(b-5)\cos\phi\right)\qquad\qquad\cdots(1)$$ where $$\sin\phi=\frac{2a-30}{\sqrt{4a^2-120a+2925}}; \cos\phi=\frac{45}{\sqrt{4a^2-120a+2925}}$$ The given ellipse can be parameterised as $$(a,b)=(3.75\cos\theta+18.75, 1.25\sin\theta+6.25)\qquad\qquad\qquad\qquad\cdots(2)$$ Substituting $(2)$ in $(1)$ gives the parameterised form of the transormed ellipse as required.

enter image description here See desmos implementation here and here.