An optimal algorithm for identifying straight lines in chain codes is
described. The algorithm turns the complicated problem of determining
the straightness of digital arcs into a simple task by constructing a
passing area around the pixels. It also solves the problem of detectin
g all straight segments from a sequence of chain codes in O(n) time, w
here n is the length of the sequence. It has been found that this algo
rithm is not only simple and intuitive, but also highly efficient.