Example applicationΒΆ

An example application fieldanimation.examples.app can be found in the examples directory.

The creation of a FieldAnimation image is straightforward: just instantiate the FieldAnimation class passing the vector field array and call its draw method within the main rendering loop. The visualization application shown above depends on two OpenGL packages:

  • pyimgui for setting interactively the visualization parameters and GLFW for rendering the OpenGL image created by FieldAnimation in a windowing system.

_images/figure2.png

The interactive GUI in this figure allows to modify the visualization parameters that FieldAnimation embeds as instance attributes:

# Default values of the class attributes
FieldAnimation.speedFactor = 0.25
FieldAnimation.decay = 0.003
FieldAnimation.decayBoost = 0.01
FieldAnimation.fadeOpacity = 0.996
FieldAnimation.color = (0.5 , 1.0 , 1.0)
FieldAnimation.palette = True
FieldAnimation.pointSize = 1.0
FieldAnimation.tracersCount = 10000
FieldAnimation.periodic = True
FieldAnimation.drawField = False

Here is a detailed description of the controls that appear in the GUI:

  • Field: select one of the available vector fields implemented.

  • Speed: set the length of the field pathlines i.e. the speed of the particles: the higher the value the longer the particle trace length.

_images/figure3.png
  • Decay: set the life span of a particle.

  • Decay boost: increase points density in low intensity field areas.

  • Opacity: set opacity of the particles over the background image.

  • Color: set color of the particles according to the the field strength trough a cubehelix based color map.

  • Palette: set color of the particles to a constant value.

_images/figure4.png
  • Point size: set the size of the animated particles (in pixels).

_images/figure5.png
  • Number of Tracers: set the number of the moving particles.

  • Periodic: if checked points that move outside the border of the rendering window will enter from the opposite one.

  • Draw Field: Draw the field modulus as a background image. In this example application the field modulus is rendered trough a cubehelix color map.

_images/figure6.png