Refactoring to template of polygon edge type.
blue intersect red (incomplete).