triangulation = matplotlib.tri.Triangulation(u.flatten(), v.flatten()) angles = u.flatten() * 2 * np.pi / N_T x, y = np.cos(angles), np.sin(angles) z = v.flatten() * 2 / N_Z mesh = [np.asarray([x, y, z]).T, triangulation.triangles] ######################################################################### # Get the locations from which vol_to_surf would draw its samples ######################################################################### line_sample_points = surface._line_sample_locations( mesh, np.eye(4), segment_half_width=.2, n_points=6) ball_sample_points = surface._ball_sample_locations( mesh, np.eye(4), ball_radius=.15, n_points=20) ###################################################################### # Plot the mesh and the sample locations ###################################################################### for sample_points in [line_sample_points, ball_sample_points]: fig = plt.figure() ax = plt.subplot(projection='3d') ax.set_aspect(1) ax.plot_trisurf(x, y, z, triangles=triangulation.triangles) ax.scatter(*sample_points.T, color='r')
mesh = [np.asarray([x, y, z]).T, triangulation.triangles] inner_mesh = [[.7, .7, 1.] * mesh[0], triangulation.triangles] ######################################################################### # Get the locations from which vol_to_surf would draw its samples ######################################################################### nested_sample_points = surface._sample_locations_between_surfaces( mesh, inner_mesh, np.eye(4)) line_sample_points = surface._line_sample_locations( mesh, np.eye(4), segment_half_width=.2, n_points=6) ball_sample_points = surface._ball_sample_locations( mesh, np.eye(4), ball_radius=.15, n_points=20) ###################################################################### # Plot the mesh and the sample locations ###################################################################### fig = plt.figure() ax = plt.subplot(projection='3d') ax.view_init(67, -42) ax.plot_trisurf(x, y, z, triangles=triangulation.triangles, alpha=.6) ax.plot_trisurf(*inner_mesh[0].T, triangles=triangulation.triangles) ax.scatter(*nested_sample_points.T, color='r') for sample_points in [line_sample_points, ball_sample_points]: fig = plt.figure()