(xy)
| 376 | |
| 377 | # Sort the points in a counter clockwise manner to ensure convex polygon is formed |
| 378 | def sort_points(xy): |
| 379 | xy = np.squeeze(xy) |
| 380 | xy_mean = np.mean(xy, axis=0) |
| 381 | theta = np.arctan2(xy[:, 1] - xy_mean[1], xy[:, 0] - xy_mean[0]) |
| 382 | return xy[np.argsort(theta, axis=0), :] |
| 383 | |
| 384 | if mp.am_master(): |
| 385 | # Point volume |