added swap and discontinous orientations, but something seems to be wrong in the algorithm, it's always monotonic