pts.append({ 'pos': mesh.vertex_coordinates(i[0]), 'radius': 0.01, 'edgecolor': (255, 0, 0), 'facecolor': (255, 255, 0) }) all_edges = mesh.edges() draw_edges_on_plotter(all_edges, (0, 0, 0), 1) #drawing mesh and line and traversing counter = 0 for i in edges0: if (counter > 0): traversedEdges = traverse(mesh, i[0]) draw_edges_on_plotter(traversedEdges, (255, 0, 0), counter + 2) counter += 1 counter = 0 for i in edges1: if (counter > 0): traversedEdges = traverse(mesh, i[0]) draw_edges_on_plotter(traversedEdges, (100, 100, 255), counter + 2) counter += 1 #draw_edges_on_plotter(edges1, (0, 255, 0),2) plotter.draw_points(pts) plotter.draw_lines(lines) plotter.show()
}) else: b = polygon.points[i + 1] - polygon.centroid lines_out.append({ 'start': polygon.points[i], 'end': polygon.points[i + 1], 'width': 1.0 }) # draw lines from polygon vertices to centroid lines_in.append({ 'start': polygon.points[i], 'end': polygon.centroid, 'width': 1.0, 'color': (130, 130, 130) }) # cross product c = cross(a, b) area = area + c[ 2] / 2 # since polygon is in xy-plane, length of resulting vector from cross product is just the z-component points.append({ 'pos': polygon.centroid, 'radius': 0.005, }) plotter = Plotter(figsize=(8, 5)) plotter.draw_points(points) plotter.draw_lines(lines_out) plotter.draw_lines(lines_in) plotter.show()