How to compute distance between movable items in the screen?

I want to design a box in which I can move a set of items. Specifically, there should be N items (e.g. little balls with numbers inside). Items can be arranged with the mouse inside a box, and, in real time, I want the program that computes a matrix with the distance between every pair of objects and its eigenvectors. I want the distance matrix to have the items as image-labels in each axis. I would really appreciate some help here, I have been using Mathematica for statistical analysis, but never for graphical processing.

EDIT

Thanks to the very generous help of J. M. , I found a way to do exactly what I wanted. Here is the code.

n = 10; (*Number of objects*)

DynamicModule[{pt = RandomReal[{-1, 1}, {n, 2}]},
Row[{Panel[
LocatorPane[Dynamic[pt], Framed@Graphics[{}],
Appearance -> Flatten[Table[{"" <> ToString[i]}, {i, n}]]]],
Dynamic[Panel[NumberForm[
MatrixForm /@ With[{d = Outer[EuclideanDistance, pt, pt, 1]},
{MatrixPlot[d, PlotLabel -> "Distances"],
MatrixPlot[Eigenvectors[d],
PlotLabel -> "Eigenvectors (Sorted)"],
Abs[Eigenvalues[d]]}], 4]]]}, Spacer]]

• What have you tried? If you don't know where to start, I'd recommend looking at LocatorPane. – C. E. Oct 3 '18 at 15:27
• I looked at this post and I am trying to do something similar stackoverflow.com/questions/6299569/…. They use Manipulate[] – user41667 Oct 3 '18 at 15:30
• It depends on what kind of UI you want. If you want to drag the pictures around then it's easiest to use LocatorPane. – C. E. Oct 3 '18 at 15:34

As a starting point:

DynamicModule[{pt = RandomReal[{-1, 1}, {5, 2}]},
Row[{Panel[LocatorPane[Dynamic[pt],
Graphics[{}, PlotRange -> 1],
Appearance -> "\[EmptyCircle]"]],
Dynamic[Panel[
NumberForm[Column[MatrixForm /@
With[{d = DistanceMatrix[pt]}, {d, Eigenvectors[d]}]], 4]]]},
Spacer]] Here is a slight modification of the OP's version:

DynamicModule[{pt = RandomReal[{-1, 1}, {10, 2}]},
Row[{Panel[LocatorPane[Dynamic[pt],
Framed[Graphics[{}, PlotRange -> 1]],
Appearance -> Array[IntegerString, Length[pt]],
LocatorAutoCreate -> True]],
Dynamic[Panel[
With[{d = DistanceMatrix[pt]},
Grid[{{MatrixPlot[d, PlotLabel -> "Distances"],
MatrixPlot[Eigenvectors[d],
PlotLabel -> "Eigenvectors (Sorted)"]},
{NumberForm[Abs[Eigenvalues[d]], 4],
SpanFromLeft}}]]]]}, Spacer]] • Thank you so much for your answer, it is super helpful. – user41667 Oct 3 '18 at 16:05
• I posted my final code, just in case you want to see it :) Thank you again! – user41667 Oct 3 '18 at 17:04
• I modified your code a bit; hopefully it's an improvement. – J. M. is away Oct 3 '18 at 17:19