def draw(self, show_normal=False, color='green'): for i, segment in enumerate(self.segments): plt.plot(segment[:, 0], segment[:, 1], color=color) if show_normal: normal = math2d.normal(segment) center = math2d.center(segment) plt.arrow(center[0], center[1], normal[0], normal[1], width=0.01, color=color)
def draw(self, draw_normals=False): #segments = continuous_path_order(self.mesh.segments) segments = self.mesh.segments xs = np.ravel(segments[:, :, 0]) ys = np.ravel(segments[:, :, 1]) plt.fill(xs, ys, color=self.color) if draw_normals: for segment in segments: normal = math2d.normal(segment) center = math2d.center(segment) plt.arrow(center[0], center[1], normal[0], normal[1], width=0.01, color=self.color)