[vtkusers] Which one is better and what's the advantage?

rakesh patil prakeshofficial at gmail.com
Wed Sep 14 12:31:11 EDT 2011


Hi,

I am reading x,y,z values from an ascii file. What is the difference among
these two approaches? Which method is good?

1)

vtkDoubleArray *arr = vtkDoubleArray::New();
arr->SetNumberOfComponents(3);
arr->SetNumberOfTuples(num);

for( vtkIdType ind = 0; ind < num; ind++ )
    arr->InsertTuple3(xval, yval, zval);

vtkPoints *pnt = vtkPoints::New();
pnt->SetData(arr);

2)

vtkPoints* pnts = vtkPoints::New();
pnts->SetNumberOfPoints(num);

for( vtkIdType ind = 0; ind < num; ind++ )
    pnts->InsertPoint(ind, xval, yval, zval);

Thanks

Warm Regards
Rakesh Patil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110914/13f97604/attachment.htm>


More information about the vtkusers mailing list