[vtkusers] VTK Glyphs
Bhanu Hariharan
bhanu at petrotel.com
Wed Mar 7 12:02:12 EST 2012
Hi,
I have a 3D Grid and I am trying to draw arrows between some grid block
pairs. However I do not see any arrows.
Can anyone please tell me what I am missing or doing wrong.
The relevant code is as follows
vtkGlyph3D * glyph = vtkGlyph3D::New();
vtkPolyDataMapper * glyphMapper = vtkPolyDataMapper::New();
vtkActor * glyphActor = vtkActor::New();
vtkArrowSource *arrow = vtkArrowSource::New();
arrow->SetTipResolution(6);
arrow->SetTipRadius(0.1);
arrow->SetTipLength(0.35);
arrow->SetShaftResolution(6);
arrow->SetShaftRadius(0.03);
vtkPoints *points = vtkPoints::New();
vtkPolyData *polydata = vtkPolyData::New();
for( some grid block pairs)
{
points->InsertNextPoint(x1, y1, z1);
points->InsertNextPoint(x2, y2, z2);
polydata->SetPoints(points);
glyph->SetInput(polydata);
glyph->SetSourceConnection(arrow->GetOutputPort());
glyph->SetVectorModeToUseVector();
glyph->SetScaleModeToScaleByVector();
glyph->SetScaleFactor(0.25);
glyph->Update();
glyphMapper->SetInputConnection(glyph->GetOutputPort());
glyphActor->SetMapper(glyphMapper);
ren->AddActor(glyphActor);
}
Here (x1, y1, z1) and (x2, y2, z2) are the centers of the grid blocks in
each pair.
Thanks,
Bhanu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120307/a92bebd9/attachment.htm>
More information about the vtkusers
mailing list