from mpl_toolkits.mplot3d.art3d import Poly3DCollection import matplotlib.pyplot as plt import numpy as np from utils.files.input import ScannedObject def render3D(obj:ScannedObject): """ Render a 3D model using matplotlib's Poly3dcollection :param obj: A ScannedObject to be rendered """ fig = plt.figure() ax = fig.add_subplot(projection='3d') faces = np.array(obj.get_faces()) verts = np.array(obj.get_vertices()) mesh = Poly3DCollection(verts[faces], alpha=0.25, edgecolor='none') ax.add_collection3d(mesh) plt.show()