The bug mentioned in an earlier post today was an easy fix. During the simulation, I do error checking to make sure that a set of links that are being moved into their new locations are not already stuck in their current location. Sort of.

image

Invalid Connections Shown Correctly

The problem was that I was moving link 1 (dark blue) and link 3 (green) to meet each other at the common connector C. The code made a bad assumption of I just forgot to check that both links were not connected to something already stuck in place. The code only tested link 1 which has no other connections. Link 3 has that connection through link 2 (cyan) to link 4 (purple and not confused with link 6). Link 4 is already fixed in place so 2 cannot be moved later.

There is still a flaw because it is possible that link 2 could work properly in a mechanism like this and not cause link 3 to bind. I am not checking the distance to see if it is valid, just that there is nothing attached to link 3 that could keep it from moving into its new position. I will need to test my theory and then improve the code.

But what I really need to do is rewrite the simulator code to be a bit less complex. There should be a way to move things into their new positions and somehow just know that a mechanism is not valid. It will take some thought before that happens.