Arrange points in sequence

偶尔善良 提交于 2019-12-05 06:41:38

问题


I have some points in 3D which are in a single plane. I want to arrange them in clock wise or counter clockwise order.
The points can create a concave or convex polygon in a single plane.
Can any body give any suggestions?


回答1:


Find the center of all the points, then calculate all the angles from the center to each point. Then sort by angle.




回答2:


Ok, I nearly solve the problem. I got line segment instead of having points in 3d. So, Now I have to arrange line segment in sequence. Which becomes somehow easier for me. I am now able to arrange them in sequence.



来源:https://stackoverflow.com/questions/2778805/arrange-points-in-sequence

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