[vtkusers] Visualize vectors in an unstructured grid (arrays)

madz madaramh at gmail.com
Tue Oct 6 01:54:00 EDT 2015


I have a 3D unstructured grid file that has a velocity vector points data.
When I try to use the vtkGlyph3D all the arrows seem to be originating from
the same point. When I view the same file in paraview however, it gives a
correct out put.
Can anyone point out where I've gone wrong.

	vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid =
vtkSmartPointer<vtkUnstructuredGrid>::New();
	unstructuredGrid->ShallowCopy(appendFilter2->GetOutput());

unstructuredGrid->GetPointData()->SetVectors(unstructuredGrid->GetPointData()->GetArray("Velocity_in_Stn_F17"));

	vtkSmartPointer<vtkMaskPoints> maskPoints
=vtkSmartPointer<vtkMaskPoints>::New();
	maskPoints->SetOnRatio(200);
	maskPoints->SetInput(unstructuredGrid);
	maskPoints->Update();

	// represent vector field
	vtkSmartPointer<vtkGlyph3D> vectorGlyph =
vtkSmartPointer<vtkGlyph3D>::New();
	vectorGlyph->SetInput(maskPoints->GetOutput());
	vectorGlyph->SetSourceConnection(arrowSource->GetOutputPort());
	vectorGlyph->SetScaleModeToScaleByVector();
	vectorGlyph->SetVectorModeToUseVector();
	vectorGlyph->ScalingOn();
	vectorGlyph->OrientOn();
	vectorGlyph->SetScaleFactor(0.05);
	vectorGlyph->Update();

	vectorGlyphMapper->SetInputConnection(vectorGlyph->GetOutputPort());
	vectorGlyphMapper->Update();

	vtkSmartPointer<vtkActor> vectorActor = vtkSmartPointer<vtkActor>::New();
	vectorActor->SetMapper(vectorGlyphMapper);


The output I'm receiving

<http://vtk.1045678.n5.nabble.com/file/n5734259/vector_1.png> 

The paraview output
<http://vtk.1045678.n5.nabble.com/file/n5734259/vector_2.png> 

Thank you. 



--
View this message in context: http://vtk.1045678.n5.nabble.com/Visualize-vectors-in-an-unstructured-grid-arrays-tp5734259.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list