Arranging coordinates into clockwise order

淺唱寂寞╮ 提交于 2019-12-05 11:58:02
Doug Currie

Find the center of the "circle," i.e., the average X and average Y

Shift the X and Y values so all are relative to the new center.

Convert to polar coordinates and sort by angle.

Assuming I understand you correctly, I would just do something like

newPosition = (originalPosition + # of rotations) mod 8

Where I am assuming that the first position is 0, and that you can only make the things jump clockwise by integer increments (hence the # of rotations)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!