# Fitting a cylinder of known length to the chord between its circular edges s.t. the cylinder's mass near a point is minimized

Let the pair of three-space coordinates $p_1$ & $p_2$ define a chord between the edges of a cylinder of radius $R_c$ and length $L$. The edges here represent the two circular borders between the smooth surfaces of the cylinder. Let $c_1$ & $c_2$ represent the end-points of the line segment running through the cylinder's center. The goal is to fit a cylinder to this chord such that the conceptual center of mass of the cylinder is positioned as far away as possible from some three-space coordinate $q$. Intuitively, I would expect that this has a unique solution.

We know a few things:

-The distance between points $c_1$ & $c_2$ is, as specified, $L$.

-The distance between points $c_1$ & $p_1$, and $c_2$ & $p_2$ is $R_c$.

-The distance between $c_1$ and $p_2$ is equal to $(L^2 + R_c^2)^\frac{1}{2}$

-The distance between $c_2$ and $p_1$ is likewise equal to $(L^2 + R_c^2)^\frac{1}{2}$

-$R_c$ and $L$ are, of course, $>0$.

My approach thus-far has been to use a symbolic manipulator (Maple and "Reduce" in Mathematica) to find a general expression for $c_1$ & $c_2$ based on these distance relations that I can use to find the cylinder with its mass positioned as far away from the point $q$ as possible. Unsurprisingly, however, my system's memory was exhausted before I could obtain anything useful.

Note! - This is a repost and a slight reformulation of an earlier question I deleted to afford myself some time to try a different approach, and I hope this is not construed as being rude or otherwise disrespectful.

-
+1 for explaining the repost. –  joriki Jan 3 '12 at 21:07

Let $a = (c_1 + c_2)/2$ be the centre of mass of the cylinder, $u = (c_1 - c_2)/L$ a unit vector representing the axis of the cylinder. Then your constraints are $u \cdot u = 1$, $(p_1 - a) \cdot u = L/2$, $(p_2 - a) \cdot u = -L/2$, and $(p_2 - a)\cdot (p_2 - a) = (p_1 - a) \cdot (p_2 - a) = R_c^2 + (L/2)^2$. Your objective is to maximize $(a - q) \cdot (a - q)$. I suggest rescaling and choosing coordinates so that $p_1 = (0,0,0)$ and $p_2 = (1,0,0)$. Note that $a_1 = 1/2$ and $u_1 = -L$. The remaining constraints say $a_2 u_2 + a_3 u_3 = 0$, $a_2^2 + a_3^2 = L_1^2/4 + R^2-1/4$, and $u_2^2 + u_3^2 = 1 - L^2$. If you write $(a_2, a_3) = b (\cos \theta, \sin \theta)$, then $(u_2, u_3) = \pm d (\sin \theta, -\cos \theta)$ where $b = \sqrt{ L_1^2/4 + R^2-1/4}$ and $d = \sqrt{1-L^2}$.
Now $(a - q) \cdot (a - q) = (1/2 - q_1)^2 + (b \cos \theta - q_2)^2 + (b \sin \theta - q_3)^2$. If $(q_2, q_3) = r (\cos \alpha, \sin \alpha)$ with $r > 0$, we want to take $\theta = - \alpha$. There is then one solution for $a$, but there are two for $u$ (assuming $L < 1$) because of the $\pm$. On the other hand, if $r = 0$ (which corresponds to $q$, $p_1$ and $p_2$ being collinear), the solution set is symmetric under rotations around the $x$ axis.