Question: Intersection or centroid

Is the shortest distance to the centroid or the intersection?

Just a simple problem really.  I thought the centroid of a set (let's say 4 at this point) of points was the shortest total distance of all points.  Then I thought isn't the intersection of the lines between the points the shortest?  Maybe that intersection point is a shorter total distance than the centroid point?

 

Let's make it an interesting problem...

 

We have 4 groups of marines stuck in the Afghan desert (for simplistic purposes, for now, we'll just use an x, y grid).  A helicopter is coming in to pick them.  Where should the helicopter direct the marines for the fastest pickup?  The centroid point? or the point of intersection of the two lines connecting the opposite set of groups?  The marine positions are stationed at (0,0) (0,16km) (14km,0) and (28km, 14km).

 

We can use the geometry package here, but there are other ways to accomplish the same thing without using the package. It's funny (well not) but because the geometry package uses names within the commands the normal variable assigning is not needed in some places.

 

restart; gc()

with(geometry)

g1 := a, 0, 0

a, 0, 0

(1)

g2 := b, 16, 0

b, 16, 0

(2)

g3 := c, 0, 14

c, 0, 14

(3)

g4 := d, 28, 14

d, 28, 14

(4)

line(l1, [point(g1), point(g4)])

line(l2, [point(g2), point(g3)])

NULL

intersection(x, l1, l2)

evalf(coordinates(x))

[10.18181818, 5.090909091]

(5)

centroid(o, [point(g1), point(g2), point(g3), point(g4)])

evalf(coordinates(o))

[11., 7.]

(6)

d1 := evalf(distance(a, x)+distance(b, x)+distance(c, x)+distance(d, x))

52.56524331

(7)

d2 := evalf(distance(a, o)+distance(b, o)+distance(d, o)+distance(d, o))

58.41028270

(8)

NULL

NULL

So there you have it, the best point for the helicopter to rendezvous with his marines is at the intersection point.  Had the helicopter landed at the centroid, he would have forced his marines to travel a total extra distance of d2-d1 = 5.84503939 km  .  Granted one group will have to travel farther than the rest but as a whole the groups need to regroup at the intersection for minimal total travelled distance.  5km is a fair amount by vehicle standards, but on foot at dawn is daunting and quite scary.  I have heard in the service field where a service tech was travelling in Bosnia with a group of soldiers in a jeep and it was getting dark and the soldiers were getting scared, they told the tech guy that they need to find a place to hide.  Now you could imagine being in Afghanistan, it's not a safe country at the best of times and at night that's something else entirely.  You could only imagine if it was getting dark and you were in the middle of nowhere.

 

NULL


Download shortest_distance.mw

Please Wait...