TITLE: Working out the shape/formula result of combining two segments on different planes
QUESTION [1 upvotes]: Given a pipe that starts at $(0,0,0)$ that curves on the horizontal plane with a radius of $400$ and curves on the vertical plane with a radius of $200$, would the resultant line be a segment of an ellipse if you laid it down flat?
As far as I can work out the constraint for this line would be:
$x^2 + (y-200)^2 = 200^2$ as the vertical plane component
where $x > 0$ and $y < 200$
$z^2 + (x+400)^2 = 400^2$ as the horizontal plane component
where $z > -400$ and $x > 0$ again
I'm not sure how I would combine these properly and whether there would even be 1 answer or if it would be a range of answers?

REPLY [1 votes]: No, it is a true 3D curve, not a planar one. It is actually shaped much like your lips are, when smiling.

You have a pair of equations:
$$\left\lbrace\begin{aligned}
x^2 + (y - 200)^2 - 200^2 &= 0 \\
z^2 + (x + 400)^2 - 400^2 &= 0 \\
\end{aligned}\right.\tag{1a}\label{NA1a}$$
You can solve this for $y$ and $z$. Given that $0 \le x \le 200$, we get
$$\left\lbrace\begin{aligned}
y &= 200 \pm \sqrt{x^2 - 200} \\
z &= \pm \sqrt{x (800 - x)} \\
\end{aligned}\right.\tag{1b}\label{NA1b}$$
We can parametrize this closed curve for $0 \le t \le 1$ thus:
$$\begin{aligned}
x(t) &= \begin{cases}
200 - 800 t, & 0 \le t \le \frac{1}{4} \\
800 t - 200, & \frac{1}{4} \le t \le \frac{2}{4} \\
600 - 800 t, & \frac{2}{4} \le t \le \frac{3}{4} \\
800 t - 600, & \frac{3}{4} \le t \le 1 \\
\end{cases} \\
y(t) &= \begin{cases}
200 + \sqrt{200^2 - x^2}, & 0 \le t \le \frac{1}{2} \\
200 - \sqrt{200^2 - x^2}, & \frac{1}{2} \le t \le 1 \\
\end{cases} \\
z(t) &= \begin{cases}
\sqrt{x (800 - x)}, & 0 \le t \le \frac{1}{4} \; \text{or} \; \frac{3}{4} \le t \le 1 \\
-\sqrt{x (800 - x)}, & \frac{1}{4} \le t \le \frac{3}{4} \\
\end{cases} \\
\end{aligned}\tag{2a}\label{NA2a}$$
i.e.
$$\begin{aligned}
x(t) &= \begin{cases}
200 - 800 t, & 0 \le t \le \frac{1}{4} \\
800 t - 200, & \frac{1}{4} \le t \le \frac{2}{4} \\
600 - 800 t, & \frac{2}{4} \le t \le \frac{3}{4} \\
800 t - 600, & \frac{3}{4} \le t \le 1 \\
\end{cases} \\
y(t) &= \begin{cases}
200 + 400\sqrt{2 t (1 - 2 t)}, & 0 \le t \le \frac{2}{4} \\
200 - 400\sqrt{2 (1 - 2 t)(t - 1)}, & \frac{2}{4} \le t \le 1 \\
\end{cases} \\
z(t) &= \begin{cases}
-200 \sqrt{-16 t^2 - 8 t + 3}, & 0 \le t \le \frac{2}{4} \\
200 \sqrt{-16 t^2 + 24 t - 5}, & \frac{1}{4} \le t \le \frac{2}{4} \\
200 \sqrt{-16 t^2 + 8 t + 3}, & \frac{2}{4} \le t \le \frac{3}{4} \\
-200 \sqrt{-16 t^2 + 40 t - 21}, & \frac{3}{4} \le t \le 1 \\
\end{cases} \\
\end{aligned}\tag{2b}\label{NA2b}$$
For simple illustration, you can use e.g. Awk to generate a file containing 800 samples (at regular intervals in $x$). For example,
awk 'BEGIN { \
     for (x = 200; x > 0;    x--) printf "%f %f %d\n", x, 200+sqrt(200*200-x*x), -sqrt(x*(800-x)); \
     for (x = 0;   x < 200;  x++) printf "%f %f %f\n", x, 200+sqrt(200*200-x*x), +sqrt(x*(800-x)); \
     for (x = 200; x > 0;    x--) printf "%f %f %d\n", x, 200-sqrt(200*200-x*x), +sqrt(x*(800-x)); \
     for (x = 0;   x <= 200; x++) printf "%f %f %f\n", x, 200-sqrt(200*200-x*x), -sqrt(x*(800-x)); \
     }' > 'output.txt'

You can then use e.g. Gnuplot to visualize the curve in 3D. Start Gnuplot, and run
splot "output.txt" u 1:2:3 notitle w lines lc -1

This gives you an interactive window to examine the curve. Both GNU awk (gawk) and gnuplot are available for basically all operating systems. (Windows users, check out ezwinports for gawk, and Tatsuro Matsuokas Windows installers for gnuplot. They are free and open software, so anyone can compile them for their own system if they want.)
{"set_name": "stack_exchange", "score": 1, "question_id": 2907734}