小编Ala*_*Tox的帖子

在javascript中逆时针排序点

我在画布中引入了一组点: 我的画布带有一组点

我必须将此算法应用于: Algo NoObtuse和此算法生成的图形示例

我的问题是从最右边的点开始,以逆时针顺序找到以下点(算法中的第2点).

那么,每次从一个点开始,我们如何才能在这个方向找到以下几点?

编辑: - > Blindman67的代码结果

//First points (before sort and anti-clockwise)
//(6) [Point, Point, Point, Point, Point, Point]
0: Point {x: 458, y: 249, col: "red"}
1: Point {x: 333, y: 40, col: "red"}
2: Point {x: 138, y: 111, col: "red"}
3: Point {x: 336, y: 209, col: "red"}
4: Point {x: 237, y: 251, col: "red"}
5: Point {x: 60, y: 351, col: "red"}

//Points after sort and anti-clockwise
//(6) [Point, …
Run Code Online (Sandbox Code Playgroud)

javascript sorting canvas

1
推荐指数
1
解决办法
1725
查看次数

标签 统计

canvas ×1

javascript ×1

sorting ×1