Implementations of the Bug1 and Bug2 algorithms