added annoying trig stuff to prevent edge generation too close to obstacles. fixed bug where the image data wasn't being set properly when opening a file.