| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
import numpy as np |
| 4 |
import matplotlib |
| 5 |
import matplotlib.tri |
| 6 |
import matplotlib.pyplot as plt |
| 7 |
import sys |
| 8 |
|
| 9 |
# plots the output of printTIN |
| 10 |
|
| 11 |
if len(sys.argv) == 2: |
| 12 |
fname = sys.argv[1]; |
| 13 |
else: |
| 14 |
print("Usage: {} fname".format(sys.argv[0])) |
| 15 |
exit(1) |
| 16 |
|
| 17 |
|
| 18 |
verts = np.loadtxt(fname + "_verts.txt") |
| 19 |
tris = np.loadtxt(fname + "_triangles.txt", int) |
| 20 |
|
| 21 |
print("verts = \n", verts) |
| 22 |
print("triangles = \n", tris) |
| 23 |
|
| 24 |
tri = matplotlib.tri.Triangulation(verts[:, 0], verts[:, 1], tris) |
| 25 |
|
| 26 |
fig, ax = plt.subplots() |
| 27 |
ax.triplot(tri) |
| 28 |
|
| 29 |
fig.savefig(fname + ".png", dpi=300) |