[vtkusers] Please help a new user.

Mathieu Malaterre mathieu.malaterre at kitware.com
Tue Jun 1 12:20:28 EDT 2004


Henry J. Karpf wrote:
> I have a program that outputs 3 points for a many(1000's) triangular 
> planes, and also their Normal vector, it is sort of in the following 
> format:
> x1 y1 z1 x2 y2 z2 x3 y3 z3 xnormal ynormal znormal
> x1 y1 z1 x2 y2 z2 x3 y3 z3 xnormal ynormal znormal
> x1 y1 z1 x2 y2 z2 x3 y3 z3 xnormal ynormal znormal
> ...
> and would like to be able to build a VTK document out of this 
> information so i can use paraview to visualize my model.  Does any one 
> have any hits or links to places that would be able to help me? Thank you!

ParaView does not currently allows you to define your own data file, I 
guess you can easily do it in python. Or in c++ you'll have to do 
something like:

ifstream f("foobar.txt");

vtkPoints* points = vtkPoints::New();
double x;
double y;
double z;
do{
   f >> x;
   f >> y;
   f >> z;
   points->InsertNextPoint( x, y, z);

   //next point
   ...
   //next point
   ...
   //normals, you can discard it since vtk has a vtkPolyDataNormals
   ...
   }
while(!f.eof());

vtkPolyData *pd =
   pd->SetPoints( points );



HTH
Mathieu





More information about the vtkusers mailing list