[vtkusers] normal estimation "z" component
    seafather 
    taleb.alashkar at telecom-lille.fr
       
    Mon Feb 23 08:52:56 EST 2015
    
    
  
Thank you david, 
I succeed to have the "z" component of the Normals in one vtkFloatArray  but
how can I viualize thme? 
thank you for your help.
Greetings
this is my code: 
	vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
	vtkActor *actor = vtkActor::New();
	vtkRenderer *renderer = vtkRenderer::New();
	vtkRenderWindow *renWin = vtkRenderWindow::New();
	vtkRenderWindowInteractor *interactor =        
vtkRenderWindowInteractor::New();
	vtkWindowToImageFilter *filter =  vtkWindowToImageFilter::New();
	vtkBMPWriter *imageWriter = vtkBMPWriter::New();
	 vtkImageShiftScale *scale = vtkImageShiftScale::New();
	
	//// Normal Estiamtion 
	vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New();
	vtkSmartPointer<vtkPolyDataNormals> normalGenerator =
vtkSmartPointer<vtkPolyDataNormals>::New();
						
	#if VTK_MAJOR_VERSION <= 5
	normalGenerator->SetInput(FaceImporter);
	#else
	normalGenerator->SetInputData(FaceImporter);
	#endif
		normalGenerator->ComputePointNormalsOn();
		normalGenerator->ComputeCellNormalsOn();
		 normalGenerator->ConsistencyOn() ; 
		 normalGenerator->AutoOrientNormalsOn() ; 
		normalGenerator->Update();
		polydata=normalGenerator->GetOutput(); 
  vtkFloatArray* normalDataFloat =
vtkFloatArray::SafeDownCast(polydata->GetCellData()->GetNormals()); 
			int nc = normalDataFloat->GetNumberOfTuples(); 
			int nup=nc/3; 
			 double pN[3]; 
			 vtkSmartPointer<vtkFloatArray> normal_z =
vtkSmartPointer<vtkFloatArray>::New();
						 for(vtkIdType i = 0; i <nup; i++) 
							  { 
							  polydata->GetPoint(i, pN); 
	
							   double testDouble[3]; 
							  normalDataFloat->GetTuple(i, testDouble); 
							  normal_z->InsertNextValue(testDouble[2]); 
							
							}
//Visualization step 
	vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
	vtkActor *actor = vtkActor::New();
	vtkRenderer *renderer = vtkRenderer::New();
	vtkRenderWindow *renWin = vtkRenderWindow::New();
	vtkRenderWindowInteractor *interactor =  vtkRenderWindowInteractor::New();
   HOW CAN I visulize the Normal_z here ? 
Greetings
    }
--
View this message in context: http://vtk.1045678.n5.nabble.com/normal-estimation-z-component-tp5730441p5730484.html
Sent from the VTK - Users mailing list archive at Nabble.com.
    
    
More information about the vtkusers
mailing list