![]() S = (vertices * vertices - vertices * vertices)Ĭ_x = C_x + (vertices + vertices) * sĬ_y = C_y + (vertices + vertices) * sĪx.plot(vor.filtered_points, vor.filtered_points, 'b.')Īx.plot(vertices, vertices, 'go') If not(bounding_box - eps <= x and x <= bounding_box + eps andīounding_box - eps <= y and y <= bounding_box + eps): ![]() Points_up = bounding_box + (bounding_box - points_up) Points_down = bounding_box - (points_down - bounding_box) Points_right = bounding_box + (bounding_box - points_right) Points_left = bounding_box - (points_left - bounding_box) Return np.logical_and(np.logical_and(bounding_box <= towers, Here is the code import matplotlib.pyplot as plīounding_box = np.array() # What if after one iteration I try to re-run the algorithm on the centroids (in red) rather than the initial points (in blue)? What if I try it again and again?Ĭool! Voronoï cells tend to minimize their energy. Here is an image of the result (centroids are in red): And get the centroid of each face according to the well-known formula to compute centroid of polygon. What to do next? Just filter points, edges or faces according to the bounding box. The previous image depicts the resulting Voronoï diagram (I use _plot_2d). With reflection symmetries according to x = 1.0, y = 0.0 and y = 1.0 (other edges of the bounding box), I get all the points (in blue) I need to do the job. ![]() x ) by a reflection symmetry according to x = 0.0 (left edge of the bounding box). Then I get the points (in blue) on the left (i.e. What I did here? That's pretty simple! The initial points (in blue) lie in x. What about adding points to constraint the Voronoï cells of the initial points to lie in the bounding box? Solution for a bounded Voronoï diagram However, here is the second idea (hack?) that came to my mind: the algorithms to compute the Voronoï diagram of a set of n points in the plane have a time complexity of O(n ln(n)). An idea not necessarily great, since this requires to code a large number of basic functions of computational geometry. Given a rectangular bounding box, my first idea was to define a kind of intersection operation between this bounding box and the Voronoï diagram produce by. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |