[vtkusers] problems in update the position! Please help!!

german german_leung at hotmail.com
Sat Feb 24 02:27:38 EST 2001


Dear all VTK User:
I try to update the position of the image use scanf function but can not work! Can anyone give me some idea!! Please !
My code is:---------------------------------------
// vtk1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "vtk.h"
#include "stdio.h"


void main()

{
int x,y,z;
 //for (int i = 1; i > 2000; i++)


 
 vtkRenderWindow *renWin;
 vtkRenderer *ren1;
 vtkRenderWindowInteractor *iren;
 vtkSTLReader *hip;
 vtkPolyDataMapper *joinMapper;
 vtkActor *joinActor;
 vtkSTLReader *cut;
 vtkPolyDataMapper *cutterMapper;
 vtkActor *cutterActor;
//create a window;

 renWin = vtkRenderWindow::New();
 ren1 = vtkRenderer::New();
 renWin->AddRenderer(ren1);
 iren=vtkRenderWindowInteractor::New();
 iren->SetRenderWindow(renWin);

 
 hip = vtkSTLReader::New();
 
 hip->SetFileName("ballJoint60.stl");
 //map to graphics lib
 
 joinMapper = vtkPolyDataMapper::New();
 
 joinMapper -> SetInput (hip->GetOutput());

 //input cutter
 cut = vtkSTLReader::New();
 cut->SetFileName("cutter3.stl");
 cutterMapper = vtkPolyDataMapper::New();
 cutterMapper -> SetInput (cut->GetOutput());

 //actor coordniates geometry
 joinActor = vtkActor::New();
 cutterActor = vtkActor::New();
//for (int i = 1; i > 10; i++)
//{
joinActor->SetPosition(0, 0, 0);
joinActor->RotateX(-90);
joinActor->SetMapper(joinMapper);

//printf("n\please enter x y z \n");
scanf("%f %f %f",&x,&y,&z);
cutterActor->SetPosition(x, y ,z);
cutterActor->RotateX(-90);
cutterActor->SetMapper(cutterMapper);
 

 
 ren1->AddActor(joinActor);
 ren1->AddActor(cutterActor);
 ren1->SetBackground(0.1,0.2,0.4);

 renWin->SetSize(700,700);





 renWin->Render();
 iren->Start(); 

 //return 0;




}
-------------------------------
I just want to change the cutter postion according to my input from the keyboard!  Because later I will use the encoder signal to control the position of the cutter position!!
Please sent me some advise!
I am really need that information!

Best Regards,
German
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010224/6d0377a2/attachment.htm>


More information about the vtkusers mailing list