Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (face, True)
sf = np.array([], dtype=np.int32)
for ring in face:
sf = np.hstack( (sf, np.array(ring)) )
sfv = vnp[sf]
# print(sf)
# print(sfv)
rings = np.zeros(len(face), dtype=np.int32)
total = 0
for i in range(len(face)):
total += len(face[i])
rings[i] = total
# print(rings)
# 1. normal with Newell's method
n, b = geom_help.get_normal_newell(sfv)
if b == False:
return (n, False)
# print ("Newell:", n)
# 2. project to the plane to get xy
sfv2d = np.zeros( (sfv.shape[0], 2))
# print (sfv2d)
for i,p in enumerate(sfv):
xy = geom_help.to_2d(p, n)
# print("xy", xy)
sfv2d[i][0] = xy[0]
sfv2d[i][1] = xy[1]
result = mapbox_earcut.triangulate_float64(sfv2d, rings)
# print (result.reshape(-1, 3))
for i,each in enumerate(result):
# print (sf[i])