[vtkusers] How to display the normal information !

Helena Kaldeira h_kaldeira at hotmail.co.uk
Mon Nov 21 14:24:20 EST 2005


hello everybody,
I am trying to load a 3D model and calculate its  normal so that I may print 
the values of its normals .I h ave got the following code which is derived 
from another thread of VTK partly found at
http://public.kitware.com/pipermail/vtkusers/2004-September/076497.html

*****************************************************************************
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkXMLPolyDataReader.h"
#include "vtkPolyDataNormals.h"
#include "vtkPolyData.h"
#include "vtkPointData.h"


int main( int argc, char *argv[] )
{
vtkXMLPolyDataReader *reader1 = vtkXMLPolyDataReader::New();
	reader1->SetFileName("C:\\VtkProjects\\normal\\bunny_vtp_zipper.vtp");

	vtkPolyDataNormals *dataset = vtkPolyDataNormals::New();
	dataset->SetInput(reader1->GetOutput());
	dataset->SetFeatureAngle(60.0);
	dataset->FlipNormalsOff();
	dataset->Update();

	for (int pointID=0; pointID < dataset->GetOutput()->GetNumberOfPoints(); 
pointID++)
	{
		float *point =
(float*)(reader1->GetOutput()->GetPointData()->GetNormals()->GetTuple(pointID));

		printf("x -> %f",(float)point[0]);
		printf("y -> %f",(float)point[1]);
		printf("z -> %f",(float)point[2]);


}
}
*********************************************************************
I am new to mailing list,forwarding my mail to the ppl who contributed in 
the above mentioned discussion,please  let me know if it is not allowed :)
I m really desperate to get any hint whts wrong on with my code

Thanks and Regards,
Helena

_________________________________________________________________
MSN Messenger 7.5 is now out. Download it for FREE here. 
http://messenger.msn.co.uk




More information about the vtkusers mailing list