MCPcopy Create free account
hub / github.com/NanoComp/meep / sort_points

Function sort_points

python/visualization.py:378–382  ·  view source on GitHub ↗
(xy)

Source from the content-addressed store, hash-verified

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

Callers 1

plot_volumeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected