[vtkusers] Help again

LinX camilo.jimenez at spymac.com
Mon Jul 26 18:29:45 EDT 2004


Hi again.

Thanks a lot.
It worked but now I have two more problems. The code is

#include"vtkPolyDataMapper.h"
#include"vtkActor.h"
#include"vtkRenderer.h"
#include"vtkRenderWindow.h"
#include"vtkRenderWindowInteractor.h"
#include"vtkPlane.h"
#include"vtkClipPolyData.h"
#include"vtkPolyDataReader.h"
#include"vtkPolyDataNormals.h"
#include"vtkCutter.h"
#include"vtkPolyData.h"
#include"vtkStripper.h"
#include"vtkTriangleFilter.h"

int main(void){
  vtkPolyDataReader *Reader=vtkPolyDataReader::New();
  Reader->SetFileName("a.vtk");

  vtkPolyDataNormals *Normals=vtkPolyDataNormals::New();
  Normals->SetInput(Reader->GetOutput());
  
  vtkPlane *Plane=vtkPlane::New();
  //Plane->SetOrigin(106,156,90); 
  //Plane->SetNormal(1,0,0);
  Plane->SetOrigin(168,107,126); 
  Plane->SetNormal(0,0,1);
  
  vtkClipPolyData *Clipper=vtkClipPolyData::New();
  Clipper->SetInput(Normals->GetOutput());
  Clipper->SetClipFunction(Plane);
  Clipper->GenerateClippedOutputOn();
  
  vtkPolyDataMapper *CylinderMapper=vtkPolyDataMapper::New();
  CylinderMapper->SetInput(Clipper->GetOutput());

  vtkActor *CylinderActor=vtkActor::New();
  CylinderActor->SetMapper(CylinderMapper);
  
  vtkCutter *Cutter=vtkCutter::New();
  Cutter->SetInput(Normals->GetOutput());
  Cutter->SetCutFunction(Plane);
  Cutter->GenerateCutScalarsOn();
  Cutter->SetValue(0,0.5);


  vtkStripper *cutStrips=vtkStripper::New();
  cutStrips->SetInput(Cutter->GetOutput());
  cutStrips->Update();
  
  vtkPolyData *cutPoly=vtkPolyData::New();
  cutPoly->SetPoints(cutStrips->GetPoints());
  cutPoly->SetPolys(cutStrips->GetLines());

  vtkTriangleFilter *cutTriangles=vtkTriangleFilter::New();
  cutTriangles->SetInput(cutPoly);
  
  vtkPolyDataMapper *cutMapper=vtkPolyDataMapper::New();
  cutMapper->SetInput(cutPoly);
  cutMapper->SetInput(cutTriangles->GetOutput());

  vtkActor *cutActor=vtkActor::New();
  cutActor->SetMapper(cutMapper);

  vtkPolyDataMapper *RestMapper=vtkPolyDataMapper::New();
  RestMapper->SetInput(Clipper->GetClippedOutput());
  
  vtkActor *RestActor=vtkActor::New();
  RestActor->SetMapper(RestMapper);
  
  vtkRenderer *Renderer=vtkRenderer::New();
  Renderer->AddActor(CylinderActor);
  Renderer->AddActor(RestActor);
  Renderer->AddActor(cutActor);
  Renderer->SetBackground(.2,.2,.5);

  vtkRenderWindow *RenderWindow=vtkRenderWindow::New();
  RenderWindow->AddRenderer(Renderer);
 
  vtkRenderWindowInteractor *Interactor=vtkRenderWindowInteractor::New();
  Interactor->SetRenderWindow(RenderWindow);
  Interactor->Initialize();
  Interactor->Start();

  return 0;
}

and when I do make the message is

[22:19:47] XowL> make 
Building dependencies cmake.check_depends...
-- Loading VTK CMake commands
-- Loading VTK CMake commands - done
Building object file Cylinder.o...
/home/xowl/Examples/Examples/VTK/Clip/Cylinder.cxx: In function `int main()':
/home/xowl/Examples/Examples/VTK/Clip/Cylinder.cxx:53: error: `GetPoints' 
   undeclared (first use this function)
/home/xowl/Examples/Examples/VTK/Clip/Cylinder.cxx:53: error: (Each undeclared 
   identifier is reported only once for each function it appears in.)
/home/xowl/Examples/Examples/VTK/Clip/Cylinder.cxx:54: error: `GetLines' 
   undeclared (first use this function)
make[1]: *** [Cylinder.o] Error 1
make: *** [default_target] Error 2
[22:20:15] XowL> 


I think that the reason is again a missing header so I went to the include 
path and did a grep looking for `GetLines'  and `GetPoints', I've tried all 
the headers that came out and none worked.

I'll apreciate any help you could bring me in this learning proccess.


Thanks again


LinX



More information about the vtkusers mailing list