ScanLine: Outline edge adition to active edge list

Addition of edges to the list of active edge has been made a function in
order to make the code clearer.

Signed-off-by: Celelibi <celelibi@gmail.com>
ScanLine: Sort active edges if needed

When adding active edges to the list of active edges, sort the list. The
unconditional sort should be removed soon.

Signed-off-by: Celelibi <celelibi@gmail.com>
ScanLine: Cleaner handling of active edge removal

Edges are removed from the active edge list in another function. The
control flow is also enhanced because of the removal of "continue"
statements.

Signed-off-by: Celelibi <celelibi@gmail.com>
ScanLine: No need to make a shortcut for ael_size

The shortcut was no longer used.

Signed-off-by: Celelibi <celelibi@gmail.com>
ScanLine: Try to keep the active edge sorted

By swapping the current active edges with their predecessor, we may not
need to perform a real sort on the list. And as in most cases, there is
only one self intersection pair of edge at a time, this swapping should
be sufficient.

Signed-off-by: Celelibi <celelibi@gmail.com>
ScanLine: Only sort active edges when needed

The active edge list will be sorted only when new edges have been added
without care (when ^ vertex are encountered), or when we tried to keep
the active edge list sorted and didn't succeed with only one swap.

Signed-off-by: Celelibi <celelibi@gmail.com>
Merge branch 'master' of github.com:SnqKe/Image