From projected points on an arbitrary straight line, among them M medium point, find straight line maximizing distance between projected points and M'

108 Views Asked by At

I am trying to understand the step going from

  1. Having a serial of points projected on an arbitrary straight line
    $C, D, E, F, G \rightarrow C', D', E', F', G'$
    and $M$ the medium point of $C,D,E,F,G$ projected on $M'$

enter image description here

  1. Finding the best straight line that will maximize the sum of the distances between:
    $M'$
    and the other projected points $C', D', E', F', G'$

What is the principle of the action that I am called to do to succeed?
I understand that I will change the $\overrightarrow{AB}$ vector,
but how?

(P.S.: my question hasn't accurate tags: I'm lacking knowledge to classify it)

1

There are 1 best solutions below

5
On

Obviously, the maximum depends on AB's direction but not position, i.e. if we represent AB as $y=kx+b$, it only depends on k but not b.

For example, for C, D, E, F, G = (14.1, 4.3), (4.2, 4.8), (8.8, 8), (9.7, 0), (14, 3.3): if AB is parallel to x-axis, we get $|M'C'|+|M'D'|+|M'E'|+|M'F'|+|M'G'|=15.56$ (take x only); if AB is parallel to y-axis, we get 9.72 (take y only).

Note that if we project point $(x_0, y_0)$ onto $y=kx$, we get $\left(\dfrac{x_0+ky_0}{1+k^2},\dfrac{k(x_0+ky_0)}{1+k^2}\right)$.

So we can rotate AB and find the maximum. Here is the numeric solution by Python:

from math import *
from scipy.optimize import *

C, D, E, F, G = (14.1, 4.3), (4.2, 4.8), (8.8, 8), (9.7, 0), (14, 3.3)

def proj(P, k):
    x = (P[0] + k*P[1])/(1 + k**2)
    return x, k*x

def dist(P1, P2):
    return sqrt((P1[0] - P2[0])**2 + (P1[1] - P2[1])**2)

def m(k):
    C1, D1, E1, F1, G1 = proj(C, k), proj(D, k), proj(E, k), proj(F, k), proj(G, k)
    M1 = (C1[0] + D1[0] + E1[0] + F1[0] + G1[0])/5, (C1[1] + D1[1] + E1[1] + F1[1] + G1[1])/5
    return -(dist(M1, C1) + dist(M1, D1) + dist(M1, E1) + dist(M1, F1) + dist(M1, G1))

print(m(0), m(999999))
print(minimize_scalar(m))

When AB is $y=-0.6339x$, the maximum sum is 17.3334.


Here's it's an edit of me (Marc), the opener of the question:
I've added to your response my figure with the straight line in orange coming from your calculations:
$y = -0.6339x + 5$
(I've chosen $b=5$ as $b$ value has no effect on the distances of the projected points, like you wrote).

My own line shown roughly (I measured it with a ruler) points summarizing a distance between their projection and $M'$ of
$d(C',M') + d(D',M') + d(E',M') + d(F',M') + d(G',M') = (2.7 + 1.1 + 0.2 + 1.5 + 1.8) \times 2^{*} = 14.6 \text{ units}$
$^{*}$ my ruler measures centimeters and a square on the paper is 0.5 cm long. So I have to multiply by 2 to return to graph units.

Your solution gives me:
$d(C'',M'') + d(D'',M'') + d(E'',M'') + d(F'',M'') + d(G'',M'') = (2.2 + 1.5 + 1 + 1.1 + 1.8) \times 2 = 15.2 \text{ units}$

It's possible that the measurements I've done manually here explain the gap of few units between your result and the one I red on my paper for your calculated straight line.
If I had done everything by calculation, and reported the points on a larger figure, I would have had less errors. Thanks for the explanation: I will study it carefully.

enter image description here