def coplaner_neighbors(fid, fNormal, tag): vertexIds = ModelData.dictFaces[fid].get_vids() for i in range(0, 3): j = 0 if i < 2: j = i + 1 face = CarveFunc.get_neighbor_shellface([vertexIds[i], vertexIds[j]], fid) if face not in tag and face is not None: newVertids = ModelData.dictFaces[face].get_vids() Normal = SimpleMath.get_face_normal([ModelData.dictVertices[newVertids[0]], ModelData.dictVertices[newVertids[1]], ModelData.dictVertices[newVertids[2]]]) if SimpleMath.vector_length_3(Normal) > SimpleMath.Tol and SimpleMath.dot_product_3(fNormal, Normal) > SimpleMath.NeighborAngle: tag.append(face) #only select the adjacent neighbors #coplaner_neighbors(face, Normal, tag)