https://github.com/DavidJourdan/shrink-morph
Revision ea9ea62b31c191587fcb2665df6251bd1703d8c1 authored by David Jourdan on 23 October 2023, 09:50:20 UTC, committed by GitHub on 23 October 2023, 09:50:20 UTC
1 parent f0fb7fb
Tip revision: ea9ea62b31c191587fcb2665df6251bd1703d8c1 authored by David Jourdan on 23 October 2023, 09:50:20 UTC
Update build.yml
Update build.yml
Tip revision: ea9ea62
plot-layer.py
import matplotlib.pyplot as plt
import numpy as np
import sys
plt.axis('equal')
plt.axis('off')
if len(sys.argv) > 1:
n = int(sys.argv[1])
else:
n = 1
# Open the file for reading
with open('hat.path', 'r') as file:
# Read the first line
line = file.readline()
# Continue reading lines until the end of the file is reached
while line:
x = []
y = []
num_vertices = int(line)
for i in range(num_vertices):
line = file.readline()
line_data = line.strip().split()
x.append(float(line_data[0]))
y.append(float(line_data[1]))
z = float(line_data[2])
if z == n * 0.08:
plt.plot(x, y, color='#6699cc', linewidth=0.5)
line = file.readline()
plt.savefig('Layer ' + str(n) + '.svg')

Computing file changes ...