Commit d679bc50 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

only triangulate once for planar layers

parent 28255832
......@@ -77,7 +77,13 @@ class Slicer:
z = tu.non_planar_z_arr(x, y, self.heights) if self.nonplanar else tu.planar_z_arr(x, y, self.heights)
[x, y] = tu.copy_over_array([x, y], len(self.heights))
for layer_i in range(len(self.surfs)):
self.surfs[layer_i] = tu.gen_single_surf(x[layer_i], y[layer_i], z[layer_i])
if not self.nonplanar and layer_i > 0:
#do not regenerate surfaces if planar
new_surf = self.surfs[0].copy()
new_surf.points[:,2] = np.ones(new_surf.points.shape[0])*self.heights[layer_i]
self.surfs[layer_i] = new_surf
self.surfs[layer_i] = tu.gen_single_surf(x[layer_i], y[layer_i], z[layer_i])
print("Surface", layer_i, "added. At Z", self.heights[layer_i], "of", self.heights[len(self.heights)-1])
e = time.time()
print('\033[96m' + "Surface generation complete in ", round(e-s, 3), " seconds!" + '\033[0m')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment