5

This is an IRL problem. I'm working in an architecture studio and trying to build an object using gdl (geometric descriptive language) code that would draw a curved ramp with different width at the top and bottom for any given angle of the ramp. In a simple case, one side of the ramp can be an arc of a circle but the other would be an ellipse. In a more complex variant, neither would be an arc of a circle. I believe this should not make a difference as it would be simply solving two equations that are independent of one another.

With given the top and bottom widths, outer radius and angle as known variables, how could I solve this?

90 degree ramp: 90 degree ramp

60 degree ramp: 60 degree ramp

DavorP
  • 51
  • In your diagram, let $a = \text{outer radius} - \text{bottom width}$ and $b = \text{outer radius} - \text{top width}$. The equation of the ellipsoid is $(x/a)^2 + (y/b)^2 = 1$. Check: if $x = -a$ and $y = 0$, then this equation is satisfied. Likewise, if $y = b$ and $x=0$, the equation is also satisfied. So the ellipse given by the equation above does indeed pass through those two points. – littleO May 26 '22 at 01:01
  • 1
    Thanks, I'll have a look. Does this solve both the 90 and 60 degree example? It would need to work for any angle. – DavorP May 26 '22 at 05:15
  • I don't understand from question, what quantity one needs to find. What does mean exactly "solve this"? – Ivan Kaznacheyeu May 26 '22 at 07:37
  • 1
    Do you literally want an "ellipse" according to the geometric definition of that term? Or do you more simply want a nice smooth curve that meets the given tangency conditions? – 2'5 9'2 May 26 '22 at 08:22
  • A conic has 5 degrees of freedom; 2 points and their tangents account for only 4 of them. You need an extra condition. Eg, declare that the center lies on one of the sides of the angle (making that side an axis). But, by making a choice, you break the natural symmetry in those sides. Also, you won't always get an ellipse. A "fair" and unambiguous option is to require a parabola (letting the fifth condition be "eccentricity $1$"). The resulting curve is the quadratic Bezier whose "control point" is where the tangents meet. – Blue May 27 '22 at 16:05

2 Answers2

2

Place the origin where "Bottom Tangent" meets "Bottom Width" and any ellipse has equation $$\left(\frac{x-a}a\right)^2+\left(\frac y b\right)^2=1$$

You know you want this ellipse to pass through a certain point. In your second diagram it is $\Big(5000-8000\cos(60^{\circ}),8000\sin(60^{\circ})\Big)=\big(1000,4000\sqrt{3}\big)$. If you plug this in for $(x,y)$ you get a relation between $a$ and $b$.

Also taking $\frac12\frac{d}{dx}$, we get $$\frac{x-a}{a^2}+\frac {yy'} {b^2}=0$$ Plug in the same point for $(x,y)$. Also at that location, for tangency you want $y'=\tan(30^{\circ})=\frac{1}{\sqrt{3}}$. Now you have a second relation in $a$ and $b$. You can solve the system of two equations in $a$ and $b$ and have a cartesian equation for the ellipse.


To demonstrate in the specific case of your second diagram, $$ \left\{ \begin{aligned} \left(\frac{1000-a}a\right)^2+\left(\frac{4000\sqrt{3}}{b}\right)^2 &=1\\ \frac{1000-a}{a^2}+\frac {4000} {b^2} &=0 \end{aligned}\right. $$ The second equation lets you isolate $b^2$ and sub it into the first equation to get $$\left(\frac{1000-a}a\right)^2+\frac{12000(a-1000)}{a^2} =1$$ $$\implies\left(1000-a\right)^2+12000(a-1000) =a^2$$ $$\implies a=1100$$ From which: $$\frac{1000-1100}{1100^2}+\frac {4000} {b^2}=0$$ $$\implies\frac {4000} {b^2}=\frac{100}{1100^2}$$ $$\implies b=2200\sqrt{10}$$ So with the origin where I placed it, your second diagram's ellipse is $$\left(\frac{x-1100}{1100}\right)^2+\left(\frac{y}{2200\sqrt{10}}\right)^2=1$$

Here is that solution alongside your outer circle and $60^{\circ}$ line, plotted using GeoGebra.

enter image description here

If you want to generalize this beyond your second diagram, you can study you to replace the numbers ($5000$, $8000$, $60^{\circ}$, etc.) with general parameters.

2'5 9'2
  • 54,717
  • Wow! Nice! Thanks for the answer. I admin I'll need to study this a bit to understand it but looks to be what I was after. – DavorP May 27 '22 at 02:59
0

Because the outer and inner radiuses are the exact same problem, we only need to find a parametric solution to one to solve both. Instead of "bottom" and "top", we'll use "wide" and "narrow", because the direction does not matter, but the order of the two radii does. We'll choose the coordinate system so that the wide part starts at the positive $x$ axis. (While technically this flips the illustrations horizontally, due to symmetries it does not matter; the parameters stay exactly the same.)

Let's call $R$ the wide radius (bottom radius), and $r$ the narrow radius (top radius), with $R \ge r$. The angle is $\theta$, limited to between $0°$ and $180°$.

We now have an ellipse with one semiaxis on the $x$ axis, and the other on the $y$ axis. Using the standard equation of the ellipse, $$\frac{x^2}{R^2} + \frac{y^2}{H^2} = 1 \tag{1}\label{1}$$ where $H$ is the unknown; the point (x, y) at angle $\theta$ being $$\frac{y}{x} = \tan\theta \tag{2}\label{2}$$ and the distance to origin there is $r$, $$x^2 + y^2 = r^2 \tag{3}\label{3}$$ we have everything we need for a single curve.

Here comes the math part.

Equation $\eqref{3}$ is equivalent to $y^2 = r^2 - x^2$. Substituting this into equation $\eqref{1}$ gives us $$\frac{x^2}{R^2} + \frac{r^2 - x^2}{H^2} = 1 \tag{4}\label{4}$$

Equation $\eqref{2}$ is equivalent to $y = x \tan \theta$, which we can square on both sides to get $y^2 = x^2 (\tan \theta)^2$. Substituting this into equation $\eqref{3}$ gives us $$\begin{aligned} x^2 t^2 &= r^2 - x^2 \\ x^2 \bigl( 1 + (\tan \theta) \bigr) &= r^2 \\ x^2 &= \frac{r^2}{1 + (\tan \theta)^2} \\ \end{aligned}$$ and finally $$ x^2 = \frac{r^2}{m^2}, \quad m^2 = 1 + (\tan \theta)^2 \tag{5}\label{5}$$ where $m^2$ is just a positive constant, at least 1, only depending on $\theta$. At $\theta = 90°$, $x^2 = 0$.

Substituting equation $\eqref{5}$ into equation $\eqref{4}$ yields $$\begin{aligned} \frac{r^2}{R^2 m^2} + \frac{r^2 - \frac{r^2}{m^2}}{H^2} &= 1 \\ \frac{r^2 - \frac{r^2}{m^2}}{H^2} &= 1 - \frac{r^2}{R^2 m^2} \\ \frac{r^2 - \frac{r^2}{m^2}}{H^2} &= \frac{R^2 m^2 - r^2}{R^2 m^2} \\ H^2 &= \left(r^2 - \frac{r^2}{m^2}\right) \frac{R^2 m^2}{R^2 m^2 - r^2} \\ H^2 &= r^2 \frac{R^2 m^2 - R^2}{R^2 m^2 - r^2} \\ \end{aligned}$$ Since $R^2 m^2 - R^2 = R^2 (m^2 - 1) = R^2 (\tan \theta)^2$, the solution for $H$ is $$H = \begin{cases} \frac{R ~ r \tan \theta}{\sqrt{ R^2 \bigl( 1 + (\tan \theta)^2 \bigr) - r^2 }}, 0 \le \theta \lt 90° \\ r, \theta = 90° \\ \frac{R ~ r \tan \theta}{\sqrt{ R^2 \bigl( 1 + (\tan \theta)^2 \bigr) - r^2 }}, 90° \lt \theta \lt 180° \\ \end{cases} \tag{6}\label{6}$$

This fully specifies the elliptical arc. The semiminor radius on the $x$ axis is $R$, and the semiminor radius on the $y$ axis is $H$, given by above equation $\eqref{6}$.


Personally, I prefer cubic arcs, especially Bézier curves.

Here, you have two points with fixed tangents as the cubic Bézier curve, so there are just two free parameters, the lengths of the initial and final tangents. The obvious choice for these would be the values that yield the nicest distance curve from origin (center axis), preferably monotonic. While I can easily program a numerical search, I don't know how to analytically even describe the solution.

Using the above definitions, the four control points $\vec{P}_0$ through $\vec{P}_3$ are $$\vec{P}_0 = (R, 0), \quad \vec{P}_1 = (0, u), \quad \vec{P}_2 = (c r - v s, s r + v c), \quad \vec{P}_3 = (c r, s r)$$ where $u$ and $v$ are the unknown parameters, $R$ and $r$ are as above, $c = \cos\theta$, and $s = \sin\theta$. The Bézier curve itself is parametrised using $t = 0 \dots 1$ via $$\vec{P}(t) = (1-t)^3 \vec{P}_0 + 3 (1-t)^2 t \vec{P}_1 + 3 (1-t) t^2 \vec{P}_2 + t^3 \vec{P}_3$$ The distance from origin -- the parameter we want to smoothly decrease from $R$ at $t=0$ to $r$ at $t=1$ –– has form $$d(t) = \left\lVert \vec{P}(t) \right\rVert = \sqrt{C_6 t^6 + C_5 t^5 + C_4 t^4 + C_3 t^3 + C_2 t^2 + C_1 t + C_0}$$ (omitting the constants $C_0$ through $C_6$, since they're a bit long, but easily calculated using Maxima, Maple, or SageMath), but we'd want it to be as close to $d(t) \approx (1-t) R + t r = R + t (r - R)$ as possible, for a single curve.

For an inner-outer curve pairs, there are four free parameters ($u$ and $v$ per curve), and more criteria to get a pleasing curve; specifically, the "width" between the curves is no longer measured along a line passing through origin, and usually it is more pleasing to have that change in a linear, smooth manner, which means qualitatively evaluating the pair of curves is much harder.

That said, for something like a foot path or paved area, an ellipse is much easier, as you can easily calculate the positions of the two focal points (they're symmetric and perpendicular to the wide part), so that a specific-length loop of string can be used to exactly draw the elliptical arc for each curve. Might be useful trick for practical landscaping.

  • Cool! Thanks! I have to dive into your answer to understand it but appreciate the effort! The software has a way of drawing a spline but only for 2D representation. Since it needs to construct this in 3D I need to calculate x,y,z values of points for the mesh. 2D spline can be drawn with the command:
    "SPLINE2 n, status, x1, y1, angle1, ..., xn, yn, anglen
    Spline, with n control points. The tangent of the spline in the control point (xi, yi) is defined by anglei, the angle with the x axis in degrees.
    Restriction of parameters:
    n >= 2"
    – DavorP May 27 '22 at 07:30
  • @DavorP: If the outer arc is always a circular arc of radius $R$, starting at width $w_0$, ending after turning by $\theta$ at width $w_1$, you can calculate the inner curve as $$r(\varphi) = R - w_0 + \frac{\varphi}{\theta}\left(w_0 - w_1\right)$$in polar coordinates; $x = r(\varphi) \cos \varphi$ and $y = r(\varphi) \sin\varphi$ in Cartesian coordinates. This yields nice spiral staircases, where each step width changes by a constant amount, $$w(\varphi) = w_0 + \frac{\varphi}{\theta}(w_1 - w_0)$$ with the outer edge always on the circular arc, and step edge towards the center axis. – Blabbo the Verbose May 27 '22 at 11:18
  • You can draw such curves –– Archimedean spirals –– in real life by using a thin wire that winds up around a fixed cylinder with diameter $$d = \frac{360°}{\theta} \frac{\lvert w_1 - w_0 \rvert}{\pi} \approx \frac{114.6°}{\theta} \left\lvert w_1 - w_0 \right\rvert$$ – Blabbo the Verbose May 27 '22 at 11:50