[vtkusers] transformation of coordinated

ejml at iespana.es ejml at iespana.es
Wed Aug 22 12:52:34 EDT 2001


Hello to all the users. I am a student of computer
engineering and in my project career end I am
building a 3D-digitizer. When representing this
objects, once the points have been taken using a
camera and a projector laser, I have used the
function vtkSurfaceReconstructionFilter, but alone it
reconstructs the object well when it is objects whose
points have their coordinates normalized in the range
[0,1]. I have this points measured in centimeters or
millimeters in a reference system which has the
origin in the center of the object, for what I will
have negative coordinates and bigger than 1. On the
other hand, I am supposing that the axis X is the
horizontal, the axis Y is the vertical and the axis Z
 is that of depth. I would need something that the
coordinates of my object digitized to normalized
coordinates transforms [0,1] to be able to represent
them by means of VTK. Does somebody know as making
it?.  

my code portion is the following one:

char cadAux[100];
FILE *fichPtos;
float x,y,z;
 
vtkRenderer *aren    = vtkRenderer::New();
vtkRenderWindow *renWin  = vtkRenderWindow::New();
renWin->AddRenderer(aren);
vtkRenderWindowInteractor *iren =
vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
 


vtkPoints *Puntos = vtkPoints::New();
 
fichPtos=fopen("mechpart.4102.pts","r");
if(fichPtos!=NULL)
{
 while(!feof(fichPtos))
 {
  fgets(cadAux,100,fichPtos);
  if(cadAux[0]=='p')  
  {
   sscanf(cadAux,"p %f %f %f\n",&x,&y,&z); 
   Puntos->InsertNextPoint(x,y,z);
  }
 }
}
 
fclose(fichPtos);
vtkPolyData *source = vtkPolyData::New();
source->SetPoints(Puntos);

vtkSurfaceReconstructionFilter *surface =
vtkSurfaceReconstructionFilter::New();
surface->SetInput(source);
 
vtkContourFilter *isosurface =
vtkContourFilter::New();
isosurface->SetInput(surface->GetOutput());
isosurface->SetValue(0,0.0);

vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInput(isosurface->GetOutput());
  
vtkActor *actor1 = vtkActor::New();
actor1->SetMapper(mapper);
actor1->GetProperty()->SetColor(0.6,0.8,0.7);
  
aren->AddActor(actor1);
renWin->Render();

// interact with data
iren->Start();
// Clean up
aren->Delete();
renWin->Delete();
iren->Delete();
mapper->Delete();
actor1->Delete();
 


  

Thank you.

 
______________________________________________________________________________
mensaje enviado desde http://www.iespana.es
emails (pop)-paginas web (espacio ilimitado)-agenda-favoritos (bookmarks)-foros -Chat






More information about the vtkusers mailing list