# Missing condition to find the minimal change of an angle

So imagine 4 rigid rods connected together to form a dashed quadrilateral as shown in the picture. Now AB is fixed, can not be changed in anyway, while all other sides (AD, BC and CD) are connected but can move freely. The initial conditions (dashed quadrilateral) are given. Now we lengthen (or shorten!) the dashed BC and AD sides to given values. Note that the length of CD remains constant!

Find coordinates of points C and D of newly generated quadrilateral in such way that the slope of AD and BC is minimally changed.

My try: Ok so the way I see the problem I have 4 values to determine $x_C, y_C, x_D$ and $y_D$.

Meaning I can try to find a system of four equations. Three of them are as follows: $$||\vec{AD}|| = \sqrt{(x_D - x_A)^2 + (y_D - y_A)^2}$$ $$||\vec{BC}|| = \sqrt{(x_C - x_B)^2 + (y_C - y_B)^2}$$ $$||\vec{CD}|| = \sqrt{(x_D - x_C)^2 + (y_D - y_C)^2}$$

Now the fourth and last equations should cover the minimal change of angles $\varphi$ and $\vartheta$, yet I'm not so sure how to write that down mathematically.

• Have you written the angle $\varphi$ as a function of the four lengths and the other angle, $theta$? And vice versa? Usually there are two solutions for each set. From that, write the change in each angle, as a function of all of the initial values, and the two changes in length. Then, minimize the sum of the magnitudes of the two angular changes, given the initial state, and the two changes in length. Is this for a new 3D printer geometry? Might be faster to do numerically in that case, you see. – Nominal Animal Jul 5 '18 at 17:32
• "The slope of $AD$ and $BC$ is minimally changed" is vague. What is exactly the quantity to minimize? Maybe the sum of the squares of the two slope differences? Or something else? – Intelligenti pauca Jul 5 '18 at 18:27
• @Aretino That's left for me to decide. I'd prefer a simple (possibly) analytical solution, if that helps. – skrat Jul 5 '18 at 18:52
• @skrat If you want an analytical solution, at least the initial condition should be rigorously, if not analytically, specified. – Saad Jul 17 '18 at 7:00

Let's rotate the illustration to fit this forum better: $$L_{AB} = \left\lVert\overline{AB}\right\rVert, \quad L_{BC} = \left\lVert\overline{BC}\right\rVert, \quad L_{CD} = \left\lVert\overline{CD}\right\rVert, \quad L_{AD} = \left\lVert\overline{AD}\right\rVert$$ $$C = B + L_{BC}\left[\begin{matrix}\cos(\varphi_B) \\ \sin(\varphi_B) \end{matrix}\right], \quad D = A + L_{AB}\left[\begin{matrix}\cos(\varphi_A) \\ \sin(\varphi_A) \end{matrix}\right]$$ Let's use a coordinate system where $A$ is at origin and $AB$ is on the $x$ axis, so $B$ is at $(L_{AB}, 0)$.
If we expand $\lVert D - C\rVert^2 - L_{CD}^2 = 0$, we get $$\begin{array}{rl} L_{AB}^2 + L_{AD}^2 + L_{BC}^2 - L_{CD}^2 - 2 L_{AD} L_{BC} \cos(\varphi_B - \varphi_A) & \; \\ + 2 L_{AB} L_{BC} \cos(\varphi_B) - 2 L_{AB} L_{AD} \cos(\varphi_A) & = 0 \end{array}$$ i.e. $$L_{AD} L_{BC} \cos(\varphi_B - \varphi_A) - L_{AB} L_{BC} \cos(\varphi_B) + L_{AB} L_{AD} \cos(\varphi_A) = \frac{L_{AB}^2 + L_{AD}^2 + L_{BC}^2 - L_{CD}^2}{2} \tag{1}\label{NA1}$$ Note that $$\cos(\varphi_B - \varphi_A) = \cos(\varphi_A)\cos(\varphi_B) + \sin(\varphi_A)\sin(\varphi_B)$$ and due to the physical constraints, $0° \le \varphi_A , \varphi_B \le 180°$, and therefore $\sin(\varphi_A)\ge 0$, $\sin(\varphi_B)\ge 0$. Therefore, if we use $$\alpha_A = \cos(\varphi_A), \quad \alpha_B = \cos(\varphi_B)$$ for the "slopes", then $$\sin(\varphi_A) = \sqrt{1 - \alpha_A^2}, \quad \sin(\varphi_B) = \sqrt{1 - \alpha_B^2}$$ and $$\cos(\varphi_B - \varphi_A) = \alpha_A \alpha_B + \sqrt{(1 - \alpha_A^2)(1 - \alpha_B^2)}$$ This means $\eqref{NA1}$ is equivalent to $$L_{AD} L_{BC} \left ( \alpha_A \alpha_B + \sqrt{(1 - \alpha_A^2)(1 - \alpha_B^2)} \right ) - L_{AB} L_{BC} \alpha_B + L_{AB} L_{AD} \alpha_A = \frac{L_{AB}^2 + L_{AD}^2 + L_{BC}^2 - L_{CD}^2}{2} \tag{2}\label{NA2}$$ There is an analytical solution for $\eqref{NA2}$ with respect to either $\alpha_A$ or $\alpha_B$. (Rearrange the above to get a quadratic function; you generally will have two real roots. The exact solutions have couple of dozen terms, and I'm too lazy to try and work out a readable format for them here.)
That is, this way you get functions $\alpha_A(L_{AD}, L_{BC}, \alpha_B) = A_0(L_{AD}, L_{BC}, \alpha_B) \pm \sqrt{A_1(L_{AD}, L_{BC}, \alpha_B)}$ and $\alpha_B(L_{AD}, L_{BC}, \alpha_A) = B_0(L_{AD}, L_{BC}, \alpha_A) \pm \sqrt{B_1(L_{AD}, L_{BC}, \alpha_A)}$, that describe one of the angles as a function of the other three parameters. Both functions are also differentiable.
How to get forward from this point, depends on exactly what you wish to minimize when $L_{AD}$ or $L_{BC}$ changes. I would personally start by exploring the behaviour of $$\alpha_B(L_{AD} + \Delta_{AD}, L_{BC}, \alpha_A + \Delta_\alpha) - \alpha_B(L_{AD}, L_{BC}, \alpha_A) = \pm \Delta_\alpha$$ (i.e., when the slopes change by a similar amount when $L_{AD}$ changes by $\Delta_{AD}$), and see if that yields a workable solution, and if this the definition of minimal change is acceptable. (The problem I perceive is when $\varphi_A$ and $\varphi_B$ differ a lot, a similar change in their slopes is not a similar change in their directions.)
If you decide that the change to be minimized is in direction (angles $\varphi_A$ and $\varphi_B$), then a similar handling yields $\varphi_A(L_{ad}, L_{bc}, \varphi_B) = \arctan(\dots, \dots)$ and $\varphi_B(L_{ad}, L_{bc}, \varphi_A) = \arctan(\dots, \dots)$.