fixed and merged planar cycle algorithm