在jupyter笔记本中可视化网格、点云和其他几何图形

threevis的Python项目详细描述


三视

python库,用于在jupyter笔记本中可视化网格、点云和其他几何图形

安装

pip install threevis

示例

快速网格检查

importthreevisimportopenmeshasomm=om.read_trimesh('examples/models/bunny.obj')threevis.display_openmesh(m)

自定义渲染

importthreevisimportopenmeshasomimportnumpyasnp# Load Meshm=om.read_trimesh('mouse.obj')# Create Contextctx=threevis.Context(width=640,height=480)# Get vertices and faces from the meshvertices=m.points()faces=m.face_vertex_indices()# We don't have normals, calculate themnormals=threevis.calculateFaceNormals(m.points(),m.face_vertex_indices())# Choose a random color for each facecolors=threevis.FaceAttribute(np.random.rand(len(faces),3))# Draw the mesh with flat shadingctx.draw_faces(vertices,faces,normals=normals,colors=colors,shading='flat')# Draw edges on top with random colorsctx.draw_edges(vertices,m.ev_indices(),colors=threevis.FaceAttribute(np.random.rand(len(m.ev_indices()),3)),linewidth=3)# Calculate data to display normals as edgesnormal_vis_verts,normal_vis_edges=threevis.calculateNormalEdges(vertices,faces,normals,length=0.05)# Draw the normals inctx.draw_edges(normal_vis_verts,normal_vis_edges,colors=colors)# Draw a point for each vertexctx.draw_vertices(vertices,point_size=4,colors='red')# Finally display itctx.display()

开发设置

  • 安装依赖项
  • 克隆存储库
  • pip install -e .

依赖关系

可选

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在读取属性文件时获取空指针   java NoSuchMethodError:org。springframework。靴子网状物servlet。错误错误控制器。最新SpringCloudStarter NetflixZuul中的getErrorPath()   java Spring不使用相同的JDBC连接   sqlite DB中带方括号的java数据   如何编译基于Maven的Java项目以从命令行运行它   java如何限制cowndown计时器的操作(例如登录)   java如何使用spring和springboot应用程序配置数据库?我想知道如何回答这类问题?   java中的buildpath不支持java。图书馆路径   java如何使用条目集在树映射上迭代?   java如何将IndexOf与Scanner结合使用?   xml Java SAX解析器进程监视   java在多台远程机器上运行并行junit测试   当我尝试在ListView中动态添加项时,单击按钮时java崩溃