def __init__(self, triangles, coordinates): coordinates = coordinates if coordinates.shape[0] < 4 else coordinates.T triangles = triangles if triangles.shape[0] == 3 else triangles.T Immutable.__init__( self, {}, {'coordinates': coordinates.T, 'triangles': triangles.T}, {'triangle_centers': (('triangles','coordinates'), lambda t,x: Mesh.__calculate_triangle_centers(t, x)), 'triangle_normals': (('triangle','coordinates'), lambda t,x: Mesh.__calculate_triangle_normals(t, x)), 'triangle_hash': (('triangle_centers',), lambda x: space.cKDTree(x)), 'vertex_hash': (('coordinates',), lambda x: space.cKDTree(x))})
def __init__(self, triangles, coordinates): coordinates = coordinates if coordinates.shape[0] < 4 else coordinates.T triangles = triangles if triangles.shape[0] == 3 else triangles.T Immutable.__init__(self, {}, { 'coordinates': coordinates.T, 'triangles': triangles.T }, { 'triangle_centers': (('triangles', 'coordinates'), lambda t, x: Mesh.__calculate_triangle_centers(t, x)), 'triangle_normals': (('triangle', 'coordinates'), lambda t, x: Mesh.__calculate_triangle_normals(t, x)), 'triangle_hash': (('triangle_centers', ), lambda x: space.cKDTree(x)), 'vertex_hash': (('coordinates', ), lambda x: space.cKDTree(x)) })