Mapping points on distance?

Does anyone know of java program that can take a matrix of distances between some places and map these places by plotting them?

For example, if I have the matrix

ABCD

A01236

B12047

C3409

D6790

then I would like to be able to plot the points that represent A B C and D somehow.

Any ideas?

Thanks

Andy

[367 byte] By [andy_wooda] at [2007-11-27 4:53:05]
# 1
Extend JPanel and in the paintComponent method use theGraphics object to draw what you need.Just convert the points into screen space using simple math.read: http://forum.java.sun.com/thread.jspa?threadID=5123534&start=15&tstart=0
TuringPesta at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 2

> Just convert the points into screen space using simple math.

I think the problem is that the OP doesn't have the coordinates of the points. Once you have them the maths is simple - but how do you go from a set of distances between adjacent points to a (plausible) set of coordinates?

In order to be plottable at all - as points in a 2D Euclidean space - these distances have to obey various rules: like AtoB=BtoA, AtoBtoC>=AtoC>0.

Maybe someone has a link to a discussion of an alogrithm for this. You could begin by putting the first two points anywhere. Trigonometry provides two options for the third point (so the resulting maps are mirror images). Then add the others based on some more trig and the distances given to the first three.

Sorry about the [Edits]

pbrockway2a at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 3

woops i misread the post, lol.

as for triangulating 4 points, this too is rather trivial.

put point A anywhere and surround it with a circle with radius D1

which is the distance of point B. draw 2 circles one around A

and one around B with radius D2 which is the distance to point C.

proceed with other points.

the formula for 3 points already exists. its called the Law of Cosines:

http://en.wikipedia.org/wiki/Law_of_cosines

you just have to add the 4th point.

you just have to write a simple system of equations to find the

intersection of circles.

TuringPesta at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 4
By the way, im sure you just made up the numbers in that matrixbut i wanted to point out that they dont work.A2B = 12A2C = 3B2C = 4B2C has to be a minimum of 9 and a maximum of 15.
TuringPesta at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 5
I'm afraid those numbers will have to work as they are representative of data that I have. So im guessing the method you proposed probably won't work. But many thanks anyway. In addition, I could have over 1000 points to plot...
andy_wooda at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 6
http://en.wikipedia.org/wiki/TrilaterationI'm trying to knut out an implementation... interesting little problem.
corlettka at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 7

> I'm afraid those numbers will have to work as they

> are representative of data that I have. So im

> guessing the method you proposed probably won't work.

> But many thanks anyway. In addition, I could have

> over 1000 points to plot...

Are these points connected by straight lines (or geodesics with some metric) or broken lines (such as a road map)? If the latter, it is no longer a Euclidean mathematical issue, and I think that you may be SOOL.

petes1234a at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 8

I should point out that these data points aren't really to do with distances and places as such. I was using it as an anology. Acutally...

A B C D represent objects. The numbers represent a correlation statistic between them.

...as opposed to....

A B C D represent places. The numbers represent the distances between them.

Message was edited by:

andy_wood

andy_wooda at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 9

> I should point out that these data points aren't really to do with distances and places as such. I was using it as an anology. Acutally...

with all due respect, if thats the case then WTF, lol?

you should say what you mean instead of having people waste

their time on a problem that is wrong.

and seeing as how i ve done such triangulations

i can say my solution was not wrong and even extends

into 3 dimensions using spheres.

you need to tell us how "correlation statistics" values relate to plotting positions.

TuringPesta at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 10
> I should point out that these data points aren't> really to do with distances and places as such. I was> using it as an anology. Acutally...nice subject "Mapping points on distance? "
S_i_m_ua at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 11
> nice subject "Mapping points on distance? "I think TuringPest's quote "WTF" about says it all.
petes1234a at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...
# 12

woodro,

So, WTF?What's your real problem?

... and you will need to be careful about analogies around here (especially if you're planning to pass them by reference)... You're subject definately had geometric connotations, and geometry has a nice clean set of reliable rules, which has absolutely shag all to do with statistics.

Keith.

corlettka at 2007-7-12 10:07:19 > top of Java-index,Java Essentials,Java Programming...