[vtkusers] vtk Glyphs are not showing
Bhanu Hariharan
bhanu at petrotel.com
Tue Mar 6 15:09:53 EST 2012
Hello,
I have a 3D Grid and I am trying to draw arrows between some grid block
pairs.
However I do not see any arrows. 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.
Can anyone suggest why I am not seeing any arrows? What am I missing.
Thanks,
Bhanu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120306/3686d825/attachment.htm>
More information about the vtkusers
mailing list