All pairs are calculated correctly now.
All poins splited on layers. Next step is to build closed contours.