python 3d动画库_对于简单的科学可视化3D有什么轻量级Python库

I am writing a program in python to experiment an academic idea. Look at a resultant image the program generates:

The thick skeleton lines in the middle of the leaf is what need to be visualized. Every segment of the skeleton lines has a value associated with it, in the above image (drawn by pycairo), different shades of gray are used for visualization, the lighter color means higher value, black lines indicate the lines have value 0 associated with them. The problem is visualization using colors in this case is very unintuitive for human eyes, it would be much better to visualize the values in 3D like the following (taken from a paper):

the left image is a 3D visualization of the right one, the values associated with the lines are visualized as height of consecutive walls in 3D.

What is the best library to do this? I don't want to invest much time into doing this, so a lightweight library is preferred.

解决方案

If you want lightweight, then you can use PyOpenGL to just wrap OpenGL calls in python directly. This is probably the lightest-weight option.

If you want lots of features, I'd recommend using VTK. It's a very powerful visualization toolkit with Python wrappers (included). There are other packages built on top of this (such as Mayavi and Paraview), but the VTK wrappers alone are often easier to use. This would probably be my first choice, since they have some good samples you can use - all you'd need to do is make a VtkPolyData instance, and throw it in a renderer.

That being said, for ease of development, you might want something that simplifies this for you, such as wrappers for a light-weight rendering engine like Irrlicht via Pyrr. This makes it much easier to generate the picture.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值