def plot(self): """Plot a force diagram with a plotter with all the default settings.""" from compas_plotters import MeshPlotter plotter = MeshPlotter(self, figsize=(12, 8), tight=True) plotter.draw_vertices(radius=0.05) plotter.draw_edges() plotter.show()
def visualize_mesh_traversal() -> None: ''' Datastructures task ''' mesh = Mesh.from_obj(get('faces.obj')) x_values = {} for vkey in mesh.vertices_on_boundary(): x_values[vkey] = mesh.vertex_coordinates(vkey)[0] max_x = max(x_values.values()) print("Vertices on the right edge of the mesh:") print([key for key in x_values if x_values[key] == max_x]) start_key = int(input("\nSelect start vertex: ")) path_verts = traverse_mesh(mesh, start_key) print('\nPath calculated, starting MeshPlotter.') plotter = MeshPlotter(mesh, figsize=(16, 10)) plotter.draw_vertices(text={key: key for key in path_verts}, radius=0.2, facecolor={key: '#ff0000' for key in path_verts}) plotter.draw_edges() plotter.draw_faces() plotter.show()
def plot(self): """Plot a form diagram with a plotter with all the default settings.""" from compas_plotters import MeshPlotter plotter = MeshPlotter(self, figsize=(12, 8), tight=True) vertexcolor = {} vertexcolor.update({key: '#00ff00' for key in self.vertices_where({'is_fixed': True})}) vertexcolor.update({key: '#ff0000' for key in self.vertices_where({'is_anchor': True})}) plotter.draw_vertices(facecolor=vertexcolor) plotter.draw_edges(keys=list(self.edges_where({'_is_edge': True}))) plotter.draw_faces(keys=list(self.faces_where({'_is_loaded': True}))) plotter.show()
def plot_mesh(mesh_info_dict, current_vertex_info_dict, edges_flag=1, faces_flag=1): """ This function plot the mesh and the path dynamically. But the problem is that it seems that plotter.close() have not been defined in the current version of the COMPAS (0.10.0) """ mesh = mesh_info_dict['mesh'] # define the facecolor dictionaries for vertices facecolor = {} # facecolor for all on-baoundary vertices facecolor.update({ key: (200, 200, 200) for key in mesh_info_dict['non_on_boundry_vertices'] }) # facecolor for all non-on-baoundary vertices facecolor.update({ key: (150, 150, 150) for key in mesh_info_dict['on_boundry_vertices'] }) # facecolor for all on-baoundary neighborhood vertices facecolor.update({ key: (0, 255, 0) for key in current_vertex_info_dict['non_on_boundry_neighbs_vertices'] }) # facecolor for all non-on-baoundary neighborhood vertices facecolor.update({ key: (0, 0, 255) for key in current_vertex_info_dict['on_boundry_neighbs_vertices'] }) # facecolor for the current vertes facecolor.update({current_vertex_info_dict['current_vertex']: (255, 0, 0)}) # define important vertices keys = mesh_info_dict['all_vertices'] # instantiate the MeshPlotter plotter = MeshPlotter(mesh=mesh, figsie=(4, 4)) # draw vertices plotter.draw_vertices(radius=0.3, text='key', keys=keys, facecolor=facecolor) # draw edges if edges_flag == 1: plotter.draw_edges() # draw faces if faces_flag == 1: plotter.draw_faces() # show mesh plot plotter.show()
def traverse_boundary_to_boundary(mesh): """ traverse the mesh from boundary to boundary in a "straight" line and visulize the results mesh: mesh data structure return a list of ordered vertex keys for the path and the mesh plotter with highlighted path (use plotter.show() to visualize)) """ bound_keys=mesh.vertices_on_boundary() # randomly pick a boundary key ind=randrange(len(bound_keys)) key=bound_keys[ind] pick_keys=[key] prev_fkeys=set() # non-corner vertices if mesh.vertex_degree(key)>2: f_keys=mesh.vertex_faces(key) adj_keys=mesh.face_adjacency_vertices(f_keys[0], f_keys[1]) next_key=list(set(adj_keys)-set(pick_keys))[0] pick_keys.append(next_key) prev_fkeys.update(f_keys) while next_key not in bound_keys: f_keys=mesh.vertex_faces(next_key) f_keys=list(set(f_keys)-prev_fkeys) adj_keys=mesh.face_adjacency_vertices(f_keys[0], f_keys[1]) next_key=list(set(adj_keys)-set(pick_keys))[0] pick_keys.append(next_key) prev_fkeys.update(f_keys) # corner vertices elif mesh.vertex_degree(key)==2: f_keys=mesh.vertex_faces(key) next_key=mesh.face_vertex_ancestor(f_keys[0], key) # one way of moving on the boundary! pick_keys.append(next_key) prev_fkeys.update(f_keys) while mesh.vertex_degree(next_key)!=2: f_keys=mesh.vertex_faces(next_key) f_keys=list(set(f_keys)-prev_fkeys) next_key=mesh.face_vertex_ancestor(f_keys[0], next_key) pick_keys.append(next_key) prev_fkeys.update(f_keys) # mesh plotter with highlighted path plotter = MeshPlotter(mesh, figsize=(8, 5)) plotter.draw_vertices(text='key', fontsize=10.0, radius=0.02) plotter.draw_edges() plotter.highlight_path(pick_keys, edgecolor=(255, 0, 0), edgewidth=2.0) return pick_keys, plotter
def plot(self): from compas_plotters import MeshPlotter plotter = MeshPlotter(self, figsize=(12, 8), tight=True) vertexcolor = {} vertexcolor.update({ key: '#00ff00' for key in self.vertices_where({'is_fixed': True}) }) vertexcolor.update({ key: '#0000ff' for key in self.vertices_where({'_is_external': True}) }) vertexcolor.update({ key: '#ff0000' for key in self.vertices_where({'is_anchor': True}) }) plotter.draw_vertices(facecolor=vertexcolor) plotter.draw_edges(keys=list(self.edges_where({'_is_edge': True}))) plotter.draw_faces(keys=list(self.faces_where({'_is_loaded': True}))) plotter.show()
# ========================================================================== # Import mesh # ========================================================================== mesh = Mesh() mesh = Mesh.from_json(HERE) mesh_unify_cycles(mesh) # ========================================================================== # Visualization # ========================================================================== plotter = MeshPlotter(mesh, figsize=(12, 9)) if DRAW_EDGES: plotter.draw_edges(color=(100, 100, 100), width=0.1) if DRAW_FACES: plotter.draw_faces() # ========================================================================== # Instantiate StructuralMesh() # ========================================================================== str_mesh = StructuralMesh(mesh) # ========================================================================== # Create closest-point seeds # ========================================================================== test_pt = [3.0, 2.5, 0.5]
import random import compas from compas.datastructures import Mesh from compas.topology import shortest_path from compas.utilities import pairwise from compas_plotters import MeshPlotter mesh = Mesh.from_obj(compas.get('faces.obj')) start, goal = random.choices(mesh.vertices_on_boundary(), k=2) vertices = shortest_path(mesh.adjacency, start, goal) vertexcolor = {start: (255, 0, 0)} edgecolor = {} for u, v in pairwise(vertices): vertexcolor[v] = (0, 255, 0) edgecolor[u, v] = (0, 255, 0) edgecolor[v, u] = (0, 255, 0) vertexcolor[goal] = (0, 0, 255) plotter = MeshPlotter(mesh, figsize=(12, 7.5)) plotter.draw_vertices(facecolor=vertexcolor) plotter.draw_faces() plotter.draw_edges(keys=list(pairwise(vertices)), color=edgecolor, width=2.0) plotter.show()
if u not in start and v not in start: arrows.append({ 'start': cablenet.vertex_coordinates(u), 'end': cablenet.vertex_coordinates(v), 'color': (0.0, 0.0, 0.0) }) facecolor = { key: i_to_blue(index / len(faces)) for index, key in enumerate(faces) } plotter = MeshPlotter(cablenet, figsize=(10, 7)) plotter.defaults['vertex.radius'] = 0.04 plotter.defaults['edge.width'] = 0.5 plotter.draw_edges(width={key: 3.0 for edges in cables for key in edges}) plotter.draw_vertices(radius={key: 0.06 for key in chain}, facecolor=vertexcolor) plotter.draw_arrows2(arrows) plotter.draw_faces(facecolor=facecolor, keys=faces, text={key: str(index) for index, key in enumerate(faces)}) plotter.show() # ============================================================================== # Export # ============================================================================== cablenet.to_json(FILE_O)
scale = vertical_from_zmax(form, 3.0) # ============================================================================== # visualise # ============================================================================== z = form.vertices_attribute('z') zmin = min(z) zmax = max(z) plotter = MeshPlotter(form, figsize=(12, 8), tight=True) plotter.draw_vertices( keys=list(form.vertices_where({'is_external': False})), facecolor={ key: i_to_black((attr['z'] - zmin) / (zmax - zmin)) for key, attr in form.vertices_where({'is_external': False}, True) }, radius=0.1) plotter.draw_edges( keys=list(form.edges_where({'is_edge': True})), color={key: '#00ff00' for key in form.edges_where({'is_external': True})}, width={key: 2.0 for key in form.edges_where({'is_external': True})}) plotter.draw_faces(keys=list(form.faces_where({'is_loaded': True}))) plotter.show()
import random import compas from compas.datastructures import Mesh from compas_plotters import MeshPlotter mesh = Mesh.from_obj(compas.get('faces.obj')) start = random.choice(list(mesh.edges())) edges = mesh.edge_loop(start) edgecolor = {} for edge in edges: edgecolor[edge] = (0, 255, 0) edgecolor[start] = (255, 0, 0) plotter = MeshPlotter(mesh, figsize=(12, 7.5)) plotter.draw_vertices() plotter.draw_faces() plotter.draw_edges(keys=edges, color=edgecolor, width=2.0) plotter.show()
break previous = start_key while True: vertices.append(current) if mesh.vertex_degree(current) < 4: break neighbors = mesh.vertex_neighbors(current, ordered=True) i = neighbors.index(previous) previous, current = current, neighbors[i - 2] return vertices traverse_vertices = get_traverse(start_vertex_key) #print(traverse_vertices) plotter.draw_vertices( facecolor={key: (255, 0, 0) for key in traverse_vertices}, text={key: str(key) for key in mesh.vertices()}, radius=0.2) plotter.draw_edges( #color={key: (255,0,0) for key in traverse_edges}, ) plotter.show()
form.to_json(FILE_O) # ============================================================================== # Visualisation # ============================================================================== plotter = MeshPlotter(form, figsize=(12, 8), tight=True) vertexcolor = {} vertexcolor.update({key: '#00ff00' for key in form.vertices_where({'is_fixed': True})}) vertexcolor.update({key: '#ff0000' for key in form.vertices_where({'is_anchor': True})}) radius = {key: 0.05 for key in form.vertices()} radius.update({key: 0.1 for key in form.vertices_where({'is_anchor': True})}) plotter.draw_vertices( facecolor=vertexcolor, radius=radius) edges = list(form.edges_where({'_is_edge': True})) plotter.draw_edges( keys=edges) faces = list(form.faces_where({'_is_loaded': True})) plotter.draw_faces( keys=faces, facecolor=(1.0, 0.9, 0.9),) plotter.show()
vertex_previous = vertex_present vertex_present = vertex_next print("vertices on topologically 'straight' line: ", vertices_line) return (vertices_line, edges_line) # ============================================================================== # Run # ============================================================================== vertex_input = random_vertex_on_boundaries_exl_corners(mesh) vertices, edges = straight_traversing_mesh(vertex_input, mesh) # ============================================================================== # Visualisation # ============================================================================== plotter = MeshPlotter(mesh, figsize=(16, 10)) plotter.draw_vertices(text={key: key for key in mesh.vertices()}, radius=0.2, facecolor={key: (255, 0, 0) for key in vertices}) plotter.draw_edges(keys=edges, color=(255, 0, 0)) plotter.draw_faces() plotter.show()
# ============================================================================== # Visualize # ============================================================================== edges = list(cablenet.edges_where({'is_edge': True})) stress = [cablenet.stress(key) for key in edges] cmap = Colormap(stress, 'rgb') edgecolor = {key: cmap(s) for key, s in zip(edges, stress)} utilization = [cablenet.stress(key) / cablenet.edge_attribute(key, 'yield') for key in edges] cmap = Colormap(utilization, 'red') edgecolor = {key: cmap(u) for key, u in zip(edges, utilization)} print(min(utilization)) print(max(utilization)) plotter = MeshPlotter(cablenet, figsize=(16, 9)) plotter.draw_vertices(radius=0.05, facecolor={key: (0.0, 0.0, 0.0) for key in cablenet.vertices_where({'is_anchor': True})}) plotter.draw_edges(width=2.0, color=edgecolor, keys=edges) plotter.save(FILE_P, dpi=150) # plotter.show() # ============================================================================== # Export # ============================================================================== cablenet.to_json(FILE_O)
plotter = MeshPlotter(force, figsize=(12, 8), tight=True) vertexcolor = { key: (1.0, 0.9, 0.9) for key in force.vertices() if not form.face_attribute(key, 'is_loaded') } radius = {key: 0.05 for key in force.vertices()} radius.update({ key: 0.1 for key in force.vertices() if not form.face_attribute(key, 'is_loaded') }) plotter.draw_vertices(facecolor=vertexcolor, radius=radius) color = { key: '#00ff00' for key in force.edges() if force.get_form_edge_attribute(form, key, 'is_external') } width = { key: 2.0 for key in force.edges() if force.get_form_edge_attribute(form, key, 'is_external') } plotter.draw_edges(color=color, width=width) plotter.show()
'radius': 0.01, }) for u, v in pairwise(bbox[0] + bbox[0][:1]): lines.append({'start': u, 'end': v, 'width': 0.1}) plotter.mesh = mesh plotter.draw_vertices(keys=mesh.attributes['corners'], radius=0.05, text='key') plotter.draw_faces() plotter.draw_points(points) plotter.draw_lines(lines) coldjoint = list(mesh.edges_where({'flap': 'coldjoint'})) boundary = list(mesh.edges_where({'flap': 'boundary'})) edges = coldjoint + boundary plotter.draw_edges(keys=edges, color={key: '#ff0000' for key in boundary}) plotter.show() # ============================================================================== # Export # ============================================================================== for mesh in unrolled_SOUTH: path = os.path.join(DATA, 'unrolled', "{}.json".format(mesh.attributes['name'])) mesh.to_json(path) for mesh in unrolled_WEST: path = os.path.join(DATA, 'unrolled', "{}.json".format(mesh.attributes['name']))
mesh = Mesh.from_vertices_and_faces(points, cycles) # e1 = network.edge_coordinates(0, 4) # e2 = network.edge_coordinates(1, 3) # xyz = intersection_line_line_xy(e1, e2) # network.delete_edge(0, 4) # network.delete_edge(1, 3) # x = network.add_node(x=xyz[0], y=xyz[1], z=xyz[2]) # network.add_edge(x, 0) # network.add_edge(x, 1) # network.add_edge(x, 3) # network.add_edge(x, 4) # plotter = NetworkPlotter(network, figsize=(8, 5)) # plotter.draw_nodes(text='key', radius=0.25) # plotter.draw_edges() # plotter.show() plotter = MeshPlotter(mesh, figsize=(8, 5)) plotter.draw_vertices(text='key', radius=0.25) plotter.draw_edges( keys=list(set(mesh.edges()) - set(mesh.edges_on_boundary()))) plotter.draw_faces( text='key', keys=list(set(mesh.faces()) - set(mesh.faces_on_boundary()))) plotter.save('find_cycles.png')
import compas from compas.datastructures import Mesh from compas_plotters import MeshPlotter mesh = Mesh.from_obj(compas.get('faces.obj')) vertex = mesh.get_any_vertex() nbrs = mesh.vertex_neighbors(vertex) vertexcolor = {} vertexcolor[vertex] = (255, 0, 0) edgecolor = {} for nbr in nbrs: vertexcolor[nbr] = (0, 0, 255) edgecolor[vertex, nbr] = (0, 255, 0) edgecolor[nbr, vertex] = (0, 255, 0) plotter = MeshPlotter(mesh, figsize=(12, 7.5)) plotter.draw_vertices(facecolor=vertexcolor) plotter.draw_faces() plotter.draw_edges(keys=list(edgecolor), width={edge: 2.0 for edge in edgecolor}, color=edgecolor) plotter.show()
radius = mesh.edges_attribute('radius') lines = [] for u, v in mesh.edges(): lines.append({ 'start': mesh.vertex_coordinates(u, 'xy'), 'end' : mesh.vertex_coordinates(v, 'xy'), 'color': '#cccccc', 'width': 0.5 }) plotter = MeshPlotter(mesh, figsize=(10, 7), fontsize=6) plotter.draw_lines(lines) plotter.draw_vertices(facecolor={key: '#000000' for key in mesh.vertices_where({'is_fixed': True})}) plotter.draw_edges() plotter.update(pause=1.0) def callback(k, xyz, crits, args): print(k) plotter.update_vertices() plotter.update_edges() plotter.update(pause=0.001) for key, attr in mesh.vertices(True): index = k_i[key] attr['x'] = xyz[index][0] attr['y'] = xyz[index][1] attr['z'] = xyz[index][2]
# return voronoi # ============================================================================== # Main # ============================================================================== if __name__ == "__main__": from compas.datastructures import Mesh from compas.geometry import pointcloud_xy from compas_plotters import MeshPlotter points = pointcloud_xy(200, (0, 50)) faces = delaunay_from_points(points) delaunay = Mesh.from_vertices_and_faces(points, faces) plotter = MeshPlotter(delaunay, figsize=(8, 5)) facecolor = { fkey: (255, 0, 0) if delaunay.face_normal(fkey)[2] > 0 else (0, 0, 255) for fkey in delaunay.faces() } plotter.draw_vertices(keys=list(delaunay.vertices_on_boundary()), radius=0.5) plotter.draw_faces(facecolor=facecolor) plotter.draw_edges(keys=list(delaunay.edges_on_boundary())) plotter.show()
def traverse_mesh(mesh, p_start): """Traverses a quad mesh from boundary to boundary in a "straight" line. If a corner point is selected as starting point a random choice is performed about the direction of the path. Parameters ---------- mesh : mesh object Mesh on which perform the operation. p_start: int Index of the vertex on the boundary of the mesh. Returns ------- None """ # compute path sequence = [p_start] neighbors = mesh.vertex_neighbors(p_start) current = p_start if len(neighbors) == 2: p = random.choice(neighbors) print(neighbors, p) previous, current = current, p while True: sequence.append(current) if mesh.vertex_degree(current) == 2: break neighbors = mesh.vertex_neighbors(current, ordered=True) previous = current for n in neighbors: if (mesh.is_vertex_on_boundary(n) and n != sequence[-2]): current = n else: for p in neighbors: if not mesh.is_vertex_on_boundary(p): previous, current = current, p break while True: sequence.append(current) if mesh.is_vertex_on_boundary(current): break neighbors = mesh.vertex_neighbors(current, ordered=True) i = neighbors.index(previous) previous, current = current, neighbors[i - 2] # visualize path edges = [] plotter = MeshPlotter(mesh, figsize=(10, 8), fontsize=6) for u, v in pairwise(sequence): if u < v: edges.append([u, v]) else: edges.append([v, u]) plotter.draw_vertices(facecolor={key: '#ff0000' for key in sequence}, radius=0.08, text='key', keys=sequence) plotter.draw_edges( color={(u, v): '#ff0000' for u, v in edges}, width={(u, v): 2.0 for u, v in edges}, ) plotter.show()
def plot(self): from compas_plotters import MeshPlotter plotter = MeshPlotter(self, figsize=(12, 8), tight=True) plotter.draw_vertices(radius=0.05) plotter.draw_edges() plotter.show()
DATA = os.path.join(HEAD, 'ITA19', 'modules', 'module0', '02_datastructures_and_geometry', 'data') FILE = os.path.join(DATA, 'faces.obj') mesh = Mesh.from_obj(FILE) starting_vertex = 34 path_v, path_e = get_traverse_path(starting_vertex, mesh) edges = [] #check if edge key exist in datastructure, if not flip the order of vertex keys for e in path_e: if e not in mesh.edges(): u, v = e[1], e[0] else: u, v = e[0], e[1] edges.append([u, v]) plotter = MeshPlotter(mesh, figsize=(16, 10)) plotter.draw_vertices(facecolor={key: (255, 0, 0) for key in path_v}, text={key: str(key) for key in mesh.vertices()}, radius=0.2) plotter.draw_edges(color={(u, v): (255, 0, 0) for u, v in edges}, ) plotter.draw_faces() plotter.show()
# ============================================================================== # Compute equilibrium # ============================================================================== update_xyz_numpy(cablenet) # ============================================================================== # Visualize # ============================================================================== heights = cablenet.vertices_attribute('z') cmap = Colormap(heights, 'black') vertexcolor = {key: cmap(z) for key, z in zip(cablenet.vertices(), heights)} forces = cablenet.edges_attribute('f') cmap = Colormap(forces, 'rgb') edgecolor = {key: cmap(f) for key, f in zip(cablenet.edges(), forces)} plotter = MeshPlotter(cablenet, figsize=(16, 9)) plotter.draw_vertices(facecolor=vertexcolor, radius=0.05) plotter.draw_edges(width=2.0, color=edgecolor) plotter.save(FILE_P, dpi=150) # plotter.show() # ============================================================================== # Export # ============================================================================== cablenet.to_json(FILE_O)
force = ForceDiagram.from_formdiagram(form) horizontal_nodal(form, force, alpha=100) scale = vertical_from_zmax(form, 3.0) # ============================================================================== # visualise # ============================================================================== # draw pipe diagram # and actual reaction forces z = form.vertices_attribute('z') zmin = min(z) zmax = max(z) plotter = MeshPlotter(form, figsize=(12, 8), tight=True) plotter.draw_vertices(keys=list(form.vertices()), facecolor={ key: i_to_black((attr['z'] - zmin) / (zmax - zmin)) for key, attr in form.vertices(True) }, radius=0.1) plotter.draw_edges(keys=list(form.edges_where({'_is_edge': True}))) plotter.draw_faces(keys=list(form.faces_where({'_is_loaded': True}))) plotter.show()
# ============================================================================== # Main # ============================================================================== if __name__ == '__main__': from compas.datastructures import Mesh from compas_plotters import MeshPlotter vertices = [(0.0, 0.0, 0.0), (10.0, 0.0, 0.0), (6.0, 10.0, 0.0), (0.0, 10.0, 0.0)] faces = [[0, 1, 2, 3]] mesh = Mesh.from_vertices_and_faces(vertices, faces) key = mesh.insert_vertex(0) area = sum(mesh.face_area(fkey) for fkey in mesh.faces()) / mesh.number_of_faces() print(area) for fkey in mesh.faces(): print(len(mesh.face_vertices(fkey))) finer = trimesh_remesh_triangle(mesh, target=area / 10.0) print(finer, key) plotter = MeshPlotter(finer, figsize=(10, 7)) plotter.draw_edges() plotter.show()
import os import compas from compas.datastructures import Mesh from compas_plotters import MeshPlotter HERE = os.path.dirname(__file__) DATA = os.path.join(HERE, 'data') FILE = os.path.join(DATA, 'faces.obj') mesh = Mesh.from_obj(FILE) plotter = MeshPlotter(mesh, figsize=(16, 10)) plotter.draw_vertices( facecolor={key: (255, 0, 0) for key in mesh.vertices_on_boundary()}, text={key: str(mesh.vertex_degree(key)) for key in mesh.vertices()}, radius=0.2) plotter.draw_edges(keys=list(mesh.edges_on_boundary()), color=(255, 0, 0)) plotter.draw_faces( facecolor={ key: (150, 255, 150) for key in mesh.faces() if not mesh.is_face_on_boundary(key) }) plotter.show()
radius = mesh.get_edges_attribute('radius') lines = [] for u, v in mesh.edges(): lines.append({ 'start': mesh.vertex_coordinates(u, 'xy'), 'end': mesh.vertex_coordinates(v, 'xy'), 'color': '#cccccc', 'width': 0.5 }) plotter = MeshPlotter(mesh, figsize=(10, 7), fontsize=6) plotter.draw_lines(lines) plotter.draw_vertices(facecolor={key: '#000000' for key in mesh.vertices_where({'is_fixed': True})}) plotter.draw_edges() plotter.update(pause=1.0) def callback(k, xyz, crits, args): print(k) plotter.update_vertices() plotter.update_edges() plotter.update(pause=0.001) for key, attr in mesh.vertices(True): index = k_i[key] attr['x'] = xyz[index, 0] attr['y'] = xyz[index, 1] attr['z'] = xyz[index, 2]
from compas.datastructures import trimesh_remesh from compas_plotters import MeshPlotter vertices = [(0.0, 0.0, 0.0), (10.0, 0.0, 0.0), (6.0, 10.0, 0.0), (0.0, 10.0, 0.0)] faces = [[0, 1, 2, 3]] mesh = Mesh.from_vertices_and_faces(vertices, faces) key = mesh.insert_vertex(0) fixed = [key] plotter = MeshPlotter(mesh, figsize=(8, 5)) plotter.draw_edges(width=0.5) def callback(mesh, k, args): print(k) plotter.update_edges() plotter.update() trimesh_remesh(mesh, 0.5, kmax=200, allow_boundary_split=True, allow_boundary_swap=True, allow_boundary_collapse=True, fixed=fixed,