Assignment 9: Go with the Flow
In this assignment, we will leave scalar data mostly behind us and will focus on vector fields. Two common methods for visualizing vector fields are glyphs and streamlines, in all their variants. For this assignment, you should have watched the video on chapter 7.
Task 1: Color Mapping (again) (1P)
One of the simplest way of visualizing vector data is to turn it back into scalar data and visualize the scalar data with the methods you already know. The script given in ReadVectorfield.py
already does this by loading a vector field, given over a regular grid, and visualize it using a color map. The colors are derived from the vector field magnitude at every vertex.
However, you should see that the current color map is insufficient to show the detail of the vector field. Rectify this by creating either a completely new lookup table derived from a color transfer function or by modifying the given lookup table. A corrected and meaningful color map could look like this:

Summary of Tasks: Create a meaningful color map for the vector field. Save your submission code as task1.py
.
Task 2: Glyph-based Visualization (2P)
In this task we want to enhance the visualization from above by rendering the vector field as glyphs. To achieve this, you can use the vtkGlyph2D
class. To use this filter, you must set two inputs, one of them being a source. We ask you to use arrows as source, this will create glyphs in the shape of arrows. To complete this task successfully you have to play around with the scale and quantity of the glyphs.
As you have learned in the lecture, glyph based approaches can quickly become confusing if too many or too large glyphs are used. You can, for example, change the amount of used glyphes by using a mask or a threshold filter on the input data.
A possible solution could look like the following:

Summary of Tasks: Create a meaningful glyph based rendering of the vector field. Save your submission code as task2.py
.
Task 3: Streamlines(2P)
As you probably have seen in Task 2, using glyph based visualization might not always be the best idea.
Therefore, we replace our glyph based visualization with streamlines. A streamline originates from a source point and then follows the path of the vector field from the source position.
To seed the points, you can use a two-dimensional source such as an appropriate vtkLineSource
or vtkPlaneSource
. To add streamlines use a vtkStreamTracer
. You may have to play around with the parameters a bit to get a good looking results.
A result could look like this:

Summary of Tasks: Add streamlines to the vector field. Save your submission code as task3.py
.