On Wed, Nov 23, 2005 at 10:08:59PM -0400, bulia byak wrote:
On 11/23/05, Peter Moulder <Peter.Moulder@...38...> wrote:
Tim Dwyer from the office next to mine has been working on code to move rectangles by the minimal amount enough that they no longer overlap.
I have a file where the result of Remove Overlaps is unpredictable. I select all in that file and do Remove Overlaps, it gives me one of two configurations randomly. I then undo and do it again, and I can get the same configuration or another one. Is this kind of behavior normal for this algorithm?
If you mail me the file then I'll pass it to Tim to look at.
The best explanation we can think of is if undoing & redoing involved slight changes to the coordinates (e.g. because "undo" means reading back from string and not necessarily restoring exactly the same floating point value).
When making discrete decisions like whether a box should be moved above, left, right or below another one, naturally there are certain knife-edge points on the boundary between two of those discrete choices: e.g. if two boxes are centre-aligned then there are (at least) two equally good ways of forcing them not to overlap, so a small change in coordinates can affect which way we choose. (Similarly, if two boxes' closest corners lie on a 45° line then left-right and up-down are equally good ways of resolving the overlap.)
If non-determinism can be reproduced even when starting by opening the file rather than using Undo, then I wondered whether selection order could ever change the result (in cases where two solutions are equally good, such as the examples above).
Are the two possible outcomes both reasonable, or is one noticeably better/worse?
pjrm.