Some algorithms for working with objects in 2D