Python bindings for startin, a Delaunay triangulator for the modelling of terrains.
To install the latest release: pip install startinpy
- install Rust (v1.39+)
- install maturin
maturin develop
- move to another folder, and
import startinpy
shouldn't return any error
Simple documentation of the API is available in the folder /docs/
import startinpy
pts = []
pts.append([0.0, 0.0, 11.11])
pts.append([1.0, 0.0, 22.22])
pts.append([1.0, 1.0, 33.33])
pts.append([0.0, 1.0, 44])
pts.append([0.5, 0.49, 44])
pts.append([0.45, 0.69, 44])
pts.append([0.65, 0.49, 44])
pts.append([0.75, 0.29, 44])
pts.append([1.5, 1.49, 44])
pts.append([0.6, 0.2, 44])
pts.append([0.45, 0.4, 44])
pts.append([0.1, 0.8, 44])
t = startinpy.DT()
t.insert(pts)
#-- remove vertex #4
t.remove(4)
print("# vertices:", t.number_of_vertices())
print("# triangles:", t.number_of_triangles())
print("CH: ", t.convex_hull())
itrs = t.incident_triangles_to_vertex(4);
print(itrs)
print(t.is_triangle([4, 12, 6]) )
print(t.is_triangle([5, 12, 6]) )
print("--- /Vertices ---")
for each in t.all_vertices():
print(each)
print("--- Vertices/ ---")
alltr = t.all_triangles()
print(alltr[3])
It can read LAS/LAZ and output OBJ files too:
import startinpy
t = startinpy.DT()
t.read_las("/home/elvis/myfile.laz")
print("# vertices:", t.number_of_vertices())
print("# triangles:", t.number_of_triangles())
t.write_obj("/home/elvis/output.obj")