Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_complex_shape(nb_points = 10):
- nb_shifts = 2
- nb_lines = 0
- shift_parameter = 2
- r = 1
- xy = get_points(0, 0, r, nb_points)
- xy = np.array(xy)
- shifts_indices = np.random.randint(0, nb_points ,nb_shifts) # choose random points
- if(nb_shifts > 0):
- xy[shifts_indices] = get_shifted_points(shifts_indices, nb_points, r + shift_parameter, 0, 0)
- xy = np.append(xy, [xy[0]], axis = 0) # close the circle
- x = xy[:,0]
- y = xy[:,1]
- if(nb_lines < 1): # normal circles
- tck, u = interpolate.splprep([x, y], s=0)
- unew = np.arange(0, 1.01, 0.01) # from 0 to 1.01 with step 0.01 [the number of points]
- out = interpolate.splev(unew, tck) # a circle of 101 points
- out = np.array(out).T
- else: # lines and curves
- out = new_add_random_lines(xy, nb_lines)
- return out
- enter code here
- data = get_complex_shape(8)
- points = MultiPoint(data)
- union_points = cascaded_union(points)
- triangles = triangulate(union_points)
Add Comment
Please, Sign In to add comment