[vtkusers] How to display two vtkActor objects in the same position

HuaweiTu tuhuawei09 at gmail.com
Tue Jan 15 02:01:52 EST 2013


Hi all,

I defined two vtkActor objects and want to display them in the same
position. For actor one, I use GetPosition() to get its position and
transfer the position information to actor two using SetPosition(). But I do
not know why it can not work: these two actors were shown in different
positions. Could someone give me some tips to proceed? Thanks a lot.

vtkPolyDataReader readerLiverDataOne = vtkPolyDataReader.New();
readerLiverDataOne.SetFileName("LiverOne.vtk");
readerLiverDataOne.Update();

vtkPolyDataMapper mapperLiverOne = vtkPolyDataMapper.New();
mapperLiverOne.SetInputConnection(readerLiverDataOne.GetOutputPort());
mapperLiverOne.ScalarVisibilityOff();

vtkActor actorLiverOne = vtkActor.New();
actorLiverOne.SetMapper(mapperLiverTwo;
actorLiverOne.GetProperty().SetColor(1, 1, 1);
   
double[] liverPositionOne = actorLiverOne.GetPosition();

vtkPolyDataReader readerLiverDataTwo = vtkPolyDataReader.New();
readerLiverDataTwo.SetFileName("LiverTwo.vtk");
readerLiverDataTwo.Update();

vtkPolyDataMapper mapperLiverTwo = vtkPolyDataMapper.New();
mapperLiverTwo.SetInputConnection(readerLiverDataTwo.GetOutputPort());
mapperLiverTwo.ScalarVisibilityOff();

vtkActor actorLiverTwo = vtkActor.New();
actorLiverTwo.SetMapper(mapperLiverTwo);
actorLiverTwo.GetProperty().SetColor(1, 0, 0);

actorLiverTwo.SetPosition(liverPositionOne[0], liverPositionOne[1],
liverPositionOne[2]);

renderer.AddActor(actorLiverTwo);
renderer.AddActor(actorLiverOne);








--
View this message in context: http://vtk.1045678.n5.nabble.com/How-to-display-two-vtkActor-objects-in-the-same-position-tp5717951.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list