二维运动场粒子
hienoi的Python项目详细描述
hienoi是一个框架,提供基于直观的可视化编程体验 围绕简单的二维粒子物理。
功能
- 二维粒子模拟。
- 带OpenGL视窗的图形用户界面。
- 用户友好的api。
- 支持每粒子用户属性。
- 当粒子直接通过核运行时速度很快。
- 与Python2和Python3兼容。
用法
>>>importhienoi.application>>>fromhienoiimportVector2f>>>definitialize_particle_simulation(sim):...sim.add_particle(position=Vector2f(25.0,0.0))>>>defupdate_particle_simulation(sim):...particle=sim.particles[0]...particle.force-=particle.position>>>hienoi.application.run(...particle_simulation={...'initialize_callback':initialize_particle_simulation,...'postsolve_callback':update_particle_simulation,...})
更多注释示例可以在demos文件夹中找到。
安装
$ pip install hienoi
演示
简介
平衡
轨迹
轨道
热键
^{tt2}$ + ^{tt3}$ | move view |
^{tt2}$ + ^{tt5}$ | zoom view |
^{tt6}$ | change the display mode of the particles |
^{tt7}$ | fit the view to the scene |
^{tt8}$ | show/hide the grid |
^{tt9}$ | reset the view |