[vtkusers] help needed on translation
Yaqian Fang
y.fang at epsa.uq.edu.au
Sun Apr 17 09:59:32 EDT 2005
Hi,
I'm trying to create 6 cones each of which rotates 60 degrees. The
result was they just flashed, then the first 5 were gone leaving the
last one in the scene. Could anyone please help me have a look at the
following code and tell me where went wrong?
Thank you.
vtkActor *coneActor;
vtkRenderer *ren1;
vtkRenderWindow *renWin;
vtkConeSource *cone;
vtkRenderWindowInteractor* iren;
void rotate ()
{
coneActor-> SetOrientation(0, 0, 0);
ren1->ResetCameraClippingRange();
renWin->Render();
renWin->Render();
renWin-> EraseOff();
coneActor-> SetOrigin(6.11414, 1.27386, .015175);
coneActor-> SetOrigin(0, 0, 0);
coneActor-> SetPosition(0, 0, 0);
vtkTransform *cowTransform = vtkTransform::New();
cowTransform->Identity();
coneActor-> SetUserMatrix(cowTransform-> GetMatrix());
for (int idx=1; idx<=6; idx++) {
coneActor->RotateWXYZ(60,2.19574,-1.42455,-.0331036);
coneActor->RotateY(60);
renWin->Render();
renWin->Render();
}
renWin-> EraseOn();
}
void main( int argc, char *argv[] )
{
ren1 = vtkRenderer::New();
iren = vtkRenderWindowInteractor::New();
renWin = vtkRenderWindow::New();
cone = vtkConeSource::New();
coneActor = vtkActor::New();
renWin->AddRenderer(ren1);
iren->SetRenderWindow(renWin);
cone->SetResolution(3);
cone->SetHeight(1);
cone->SetRadius(0.25);
vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
coneMapper->SetInput(cone->GetOutput());
coneMapper->ScalarVisibilityOff();
coneActor->SetMapper(coneMapper);
ren1->AddActor(coneActor);
ren1->SetBackground( 0.1, 0.2, 0.4 );
renWin->SetSize(800,800);
renWin->Render();
renWin-> EraseOff();
rotate(); /*rotate*/
iren->Start();
cone->Delete();
coneMapper->Delete();
coneActor->Delete();
ren1->Delete();
renWin->Delete();
iren->Delete();
}
Regards,
Yaqian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050417/aab3a79a/attachment.htm>
More information about the vtkusers
mailing list