I have a 1000 entry color table represented graphically by a long bar, 1000 pixels wide.
Each table entry is a vertical line 1 pixel wide and 20 pixels high.
Only a relatively small number of colors (minimun 2, maximum 56) are entered by the user.
These are what I call "nodes" and can be placed anywhere within the table. The rest of the
table entries, between the nodes, are calculated by the program. Just beneath the color bar
are small markers which show the actual node positions.
For editing purposes, the nodes are displayed as colored rectangles in a field just below the
It kind of looks like this, although with graphic elements, not text (and also not to scale):
What I would like to do is arrange the nodes in their field so that each corresponds as closelyCode:|||||||||||||||||||||||||||||||||||||||||||||||||||||||| color table ^ ^ ^ ^^ ^ node position markers [ ] [ ] [ ] [ ] [ ] [ ] nodes
as possible to it's actual table entry just above it. When the node positions are far enough apart,
this can be done exactly. But because the node rectangles are many pixels wide, some of these
rectangles will need to be displaced from the actual position above in the table when the positions
are too close.
The end result should look something like this:
In the above two illustrations, it was quite easy to do manually. I could also do it easily for someCode:|||||||||||||||||||||||||||||||||||||||||||||||||||||||| color table ^ ^ ^ ^^ ^ node position markers [ ] [ ] [ ] [ ] [ ] [ ] nodes
other arrangement, manually. The main problem though, is that there are a huge number of possible
patterns. I can't think of a way to handle any possible arrangement. Is there something related to this
that could provide a useful algorithm?
I can scan through the nodes and collect all types of data, but I'm not sure what to with it next. It seems
that there is some judgement that needs to be made, and that's where I'm stuck.
How do I translate what I easily did above just by looking at it, into a general procedure?