Evenly Spaced Streamlines 2D


VTK and ParaView provide visualization of vector fields through streamlines using vtkStreamTracer in VTK or Stream Tracer in ParaView. The ability of streamlines to create an effective visualization depends on two criteria: 1) placement of streamlines at locations where the flow needs to be visualized; and 2) Techniques to avoid streamlines crowding, as that may obstruct other visualization elements. Both randomly placing streamlines or placing them on a regular grid can lead to regions without any streamlines or regions that are too crowded.

Recently we merged in VTK – vtkEvenlySpacedStreamlines2D and ParaView – Evenly Spaced Streamlines 2D an implementation for evenly spaced streamlines for 2D datasets. This visualization method addresses both potential drawbacks of conventional streamline seeding strategies. It allows the user to control the density of streamlines while it provides good coverage of the domain. It avoids streamline crowding by terminating the current streamline when it gets too close to other streamlines. The following two images illustrate the differences between evenly spaced streamlines and randomly seeded streamlines. The first image shows equally spaced streamlines with arrow glyphs pointing to the direction of the flow.

Evenly Spaced Streamlines

Evenly spaced streamlines

The second image shows randomly seeded streamlines with approximately the same number of streamlines as the first image. Note that certain areas are not well covered while other areas are too crowded.

Randomly seeded streamlines

Randomly seeded streamlines

In the next section we present usage and implementation details for evenly spaced streamlines. We only show ParaView properties, VTK properties are easily deduced from those.


EvenlySpacedStreamlines2D works on 2D datasets parallel with the XY plane. You need to specify the StartPosition which represents the coordinates for the seed for the first streamline. From there on, all other seeds are determined automatically. The SeparatingDistance specifies how far from other streamlines a new streamline is started. SeparatingDistanceRatio specifies how close a streamline can get to other streamlines before it is terminated. If the current streamline gets closer than SeparatingDistance * SeparatingDistanceRatio to other streamlines integration stops. Loops are considered closed if they have two points at distance less than ClosedLoopMaximumDistance.

Attached is the ParaView State File used to generate the two images above and the dataset it operates on.

Implementation details

We implement the algorithm described in:
Jobard, Bruno, and Wilfrid Lefer. "Creating evenly-spaced streamlines of arbitrary density." Visualization in Scientific
Computing’97. Springer Vienna, 1997. 43-55.

The loop detection is described in:
Liu, Zhanping, Robert Moorhead, and Joe Groner. "An advanced evenly-spaced streamline placement algorithm." IEEE Transactions on Visualization and Computer Graphics 12.5 (2006): 965-972.
The algorithm works only on 2D datasets parallel with plane XY. It does not work in parallel because of its inherently serial seeding strategy. The streamlines are produced using vtkStreamTracer using only Runge-Kutta2 or Runge-Kutta4 integrators (we cannot use Runge-Kutta45 integrator). This is because the algorithm needs that points along a streamline be equally spaced. We added custom termination callbacks to vtkStreamTracer. This enables the integration to be terminated if streamlines are too close to other streamlines or if a loop is formed.


We are thankful to LLNL specifically Dean Williams for supporting this work.

11 Responses to Evenly Spaced Streamlines 2D

  1. Pingback: Wouter Remmerie

    • Pingback: Dan Lipsa

      • Pingback: Wouter Remmerie

        • Pingback: Dan Lipsa

  2. Pingback: Felix Weiler

    • Pingback: Dan Lipsa

      • Pingback: Simon Williams

  3. Pingback: Nayla

  4. Pingback: Dan Lipsa

  5. Pingback: Joao

    • Pingback: Dan Lipsa

Questions or comments are always welcome!