Closed Ylannl closed 4 years ago
With thinning=5 there was a duplicate vertex, and you used the original index of points still containing the duplicate...
You need to fetch the "correct" vertices with dt.all_vertices()
and then flush the infinity point (at index 0) to make the OBJ:
def write_obj_startin(pts, obj_filename):
print("=== Writing {} ===".format(obj_filename))
f_out = open(obj_filename, 'w')
# for p in pts:
# f_out.write("v {:.2f} {:.2f} {:.2f}\n".format(p[0], p[1], p[2]))
dt = startin.DT()
dt.insert(pts)
pts = dt.all_vertices()
for p in pts[1:]:
f_out.write("v {:.2f} {:.2f} {:.2f}\n".format(p[0], p[1], p[2]))
for simplex in dt.all_triangles():
f_out.write("f {} {} {}\n".format(simplex[0], simplex[1], simplex[2]))
f_out.close()
But this is way too messy, I'll expose the OBJ export function and document this in 0.4.7 release, coming to a computer near you this week.
Ofcourse 😅🤦🏻♂️ That makes sense. Cheers for looking into that.
I’m seeing some weird startin output. My code reads a LAS file with 250k points, does thinning , triangulates, and writes to OBJ.
If I set the thinning factor to ’20’ startin gives identical results compared to scipy.
However, if I set the thinning factor to ’5’ startin gives a broken TIN.
Below are the scipy and startin output for a thinning of '5'