I have a set of coordinates, that I can scatter plot in 2D, thus
creating a set of points (or "nodes") in a plane.
In MATLAB, is there a way that I can randomly connect lines between
these nodes, with the rule that if the lines should intersect, they
can only intersect at a node?
...another way of asking this question. . ..
I know you can generate a plot, but that usually means connecting
points in some coherent manner (data point 1 connects to data point
2, to then 3, etc. etc). Is there a way have point 1 connect to
point 10, then point 10 back to point 2, then to point 5, etc etc?
Can't you just reorder the input to plot?
So instead of
plot(x,y)
do
r=randperm(10); % the order you wish to plot in
plot(x(r),y(r));
Daniel
Arneh
----------------------
My understanding is that matlab's 'delaunay' function will give you a
triangulation for an arbitrary set of points in 2D. The sides of these
triangles sound like what you are asking for in your first paragraph,
since they connect the points and don't cross each other. Note that there
is nothing random about this procedure. Each set of points has a unique
delaunay triangulation.
However, in reference to your second paragraph, producing a single
sequence of connected points for 'plot' with non-intersecting connecting
line segments might be a more difficult problem. Random sequencing has a
high probability of producing crossing segments. If you reorder the
points in accordance with their x-coordinates, or y-coordinates, or in
fact the distance orthogonal to any particular fixed line, and connect
successive points in this ordering, this would solve your problem but the
resulting jagged appearance might not be to your liking.
I hope I have understood the question your are asking.
Roger Stafford
Arneh