Skip to content

Instantly share code, notes, and snippets.

@hugoledoux
Created May 6, 2019 14:45
Show Gist options
  • Save hugoledoux/e07a4f8f6278cc742b454bbf72566f58 to your computer and use it in GitHub Desktop.
Save hugoledoux/e07a4f8f6278cc742b454bbf72566f58 to your computer and use it in GitHub Desktop.
speed comparison startin and scipy
from scipy.spatial import Delaunay
import sys
import csv
points = []
with open('/Users/hugo/Dropbox/data/terrains/l2.txt', newline='') as csvfile:
r = csv.reader(csvfile, delimiter=' ', quotechar='|')
next(r, None) # skip the headers
for row in r:
points.append([float(row[0]), float(row[1])])
# t.insert_one_pt(float(row[0]), float(row[1]), float(row[2]))
# print(row[0])
# tri = Delaunay(points, incremental=True)
tri = Delaunay(points)
# tri.add_points([[85072.5, 447421.8]])
print("done.")
import startin
import sys
import csv
t = startin.DT()
with open('/Users/hugo/Dropbox/data/terrains/l2.txt', newline='') as csvfile:
r = csv.reader(csvfile, delimiter=' ', quotechar='|')
next(r, None) # skip the headers
for row in r:
t.insert_one_pt(float(row[0]), float(row[1]), float(row[2]))
# print(row[0])
print("# vertices:", t.number_of_vertices())
print("# triangles:", t.number_of_triangles())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment