def __init__(self, triangles, vertices, dtype=np.float64, atol=1e-8, assert_args=True): if isinstance(triangles, basestring): mesh_filename = triangles elif isinstance(vertices, basestring): mesh_filename = vertices else: mesh_filename = None if mesh_filename is not None: self.__polydata__ = vtk_u.load_polydata(mesh_filename) self.__polydata_is_up_to_date__ = True self.__polydata_color_is_scalars__ = None TriMesh.__init__(self, self.get_polydata_triangles(), self.get_polydata_vertices(), dtype=dtype, atol=atol, assert_args=assert_args) else: self.__polydata__ = None self.__polydata_is_up_to_date__ = False self.__polydata_color_is_scalars__ = None TriMesh.__init__(self, triangles, vertices, dtype=dtype, atol=atol, assert_args=assert_args)
def set_polydata(self, new_polydata): self.__polydata__ = new_polydata self.__polydata_is_up_to_date__ = True self.__polydata_color_is_scalars__ = None TriMesh.__init__(self, self.get_polydata_triangles(), self.get_polydata_vertices(), dtype=self.__dtype__, atol=self.__atol__)