Skip to content

Commit

Permalink
Add colors
Browse files Browse the repository at this point in the history
  • Loading branch information
danlipsa committed Mar 8, 2017
1 parent d3198c3 commit b1f5786
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions vcs/vcsvtk/streamlinepipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def _plotInternal(self):
streamer.SetMinimumIntegrationStep(self._gm.minimumsteplength)
streamer.SetMaximumIntegrationStep(self._gm.maximumsteplength)
streamer.SetMaximumNumberOfSteps(self._gm.maximumsteps)
if (self._gm.maximumstreamlinelength == self._gm._maximumstreamlinelength):
if (self._gm.maximumstreamlinelength ==
self._gm._maximumstreamlinelengthdefault):
# compute maximumstreamlinelength
self._gm.maximumstreamlinelength = radius / 2
streamer.SetMaximumPropagation(self._gm.maximumstreamlinelength)
Expand All @@ -110,30 +111,36 @@ def _plotInternal(self):
streamlines = streamer.GetOutput()
vcs2vtk.debugWriteGrid(streamlines, "streamlines")

# visualize direction of the flow
# visualize direction of the flow with glyphs
contour = vtk.vtkContourFilter()
contour.SetInputConnection(streamer.GetOutputPort())
contour.SetValue(0, 0)
contour.SetInputArrayToProcess(0, 0, 0, 0, "IntegrationTime")

contour.Update()
vcs2vtk.debugWriteGrid(contour.GetOutput(), "contour")

glyph2DSource = vtk.vtkGlyphSource2D()
glyph2DSource.SetGlyphTypeToThickArrow()
glyph2DSource.SetFilled(1)
glyph2DSource.Update()

glyph = vtk.vtkGlyph2D()
glyph.SetInputConnection(contour.GetOutputPort())
glyph.SetInputArrayToProcess(0, 0, 0, 0, "vector")
glyph.SetSourceData(glyph2DSource.GetOutput())

glyph.SetScaleModeToDataScalingOff()
glyph.SetScaleFactor(radius / 20)
glyph.OrientOn()
glyph.Update()
vcs2vtk.debugWriteGrid(glyph.GetOutput(), "glyph")

glyphMapper = vtk.vtkPolyDataMapper()
glyphMapper.SetInputConnection(glyph.GetOutputPort())
glyphActor = vtk.vtkActor()
glyphActor.SetMapper(glyphMapper)

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(streamer.GetOutputPort())
mapper.ScalarVisibilityOff()
Expand Down

0 comments on commit b1f5786

Please sign in to comment.