[vtkusers] Problem with streamline
    Amy Squillacote 
    ahs at cfdrc.com
       
    Fri Feb 15 10:18:17 EST 2008
    
    
  
Hi Nazrul,
Does the line that you're using to generate seed points actually lie 
within the bounds of your dataset? To find out, you can get the values 
of the line's endpoints by using the GetPoint1 and GetPoint2 methods. 
Then compare those values to the bounds of the output of the 
vtkDelaunay3D filter: delny.GetOutput().GetBounds().
Additionally, please do not post essentially the same question 
repeatedly on a mailing list. It is not likely to help you get an answer 
faster, and may actually cause people to ignore your posts.
- Amy
Mohammad Nazrul Islam wrote:
> Hi all,
>
> I am trying to plot series of streamline from my x, y, z position vector file. and I have written the following code and i am getting the output from triangulaton but not from vtkstreamline. I am trying to solve but could not yet. could anybody help pls
>
> def readpoints(filename):
>  
>  points=vtk.vtkPoints()
>  
>  file=open(filename,"r")
>  line=file.readline()
>  lines=0
>  while file:
>   line = file.readline()
>   if line == "":
>    break
>   line = str.rstrip(line)
>   cols =line.split('	')
>   if len(cols)  <3:
>    if line.find('-') == 0:
>     print "Treating as options: ",line
>     processOption(line)
>    else: 
>     print "Omitting line: ", line
>     continue
>  
>   x=cols[0]
>   y=cols[1]
>   z=cols[2]
>
>   points.SetNumberOfPoints(lines)
>   points.InsertNextPoint(float(x),float(y), float(z))
>   lines+=1
>  
>  
>  scalars=vtk.vtkFloatArray()
>  scalars.SetNumberOfTuples(lines)
>   
>  vector=vtk.vtkFloatArray()
>  vector.SetNumberOfComponents(3)
>  vector.SetNumberOfTuples(lines)
>  
>  slineGrid=vtk.vtkStructuredGrid()
>  slineGrid.GetPointData().SetScalars(scalars)
>  slineGrid.GetPointData().SetVectors(vector)
>  slineGrid.GetPointData().AddArray
>  slineGrid.SetPoints(points)
>  
>  
>  
>  delny = vtk.vtkDelaunay3D()
>  delny.SetInput(slineGrid)
>  delny.SetTolerance(1)
>  delny.SetAlpha(5)
>  delny.BoundingTriangulationOff()
>
>  #Shrink the result to help see it better.
>  shrink = vtk.vtkShrinkFilter()
>  shrink.SetInputConnection(delny.GetOutputPort())
>  shrink.SetShrinkFactor(0.9)
>
>  
>  map = vtk.vtkDataSetMapper()
>  map.SetInputConnection(delny.GetOutputPort())
>
>  triangulation = vtk.vtkActor()
>  triangulation.SetMapper(map)
>  triangulation.GetProperty().SetColor(1, 1, 1)
>  	
>  line=vtk.vtkLineSource()
>  line.SetResolution(25)	
>  
>  integ=vtk.vtkRungeKutta4()
>  
>  streamline=vtk.vtkStreamLine()
>  streamline.SetInput(delny.GetOutput()) 
>  streamline.SetSource(line.GetOutput())
>  streamline.SetMaximumPropagationTime(500)
>  streamline.SetIntegrationStepLength(0.01)
>  streamline.SetIntegrationDirectionToIntegrateBothDirections() 
>  streamline.SetStepLength(0.001)
>  streamline.SetIntegrator(integ)
>  
>  mapstreamline=vtk.vtkPolyDataMapper()
>  mapstreamline.SetInputConnection(streamline.GetOutputPort())
>  streamlineActor=vtk.vtkActor()
>  streamlineActor.SetMapper(mapstreamline)
>  return lines
> and then the rendering staff. 
>
>
>
>
> thanks in advance/
>
>
> Nazrul
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>   
-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CDF Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805
    
    
More information about the vtkusers
mailing list