[vtkusers] Marching cubes source

Eduardo Suarez-Santana esuarez at itccanarias.org
Wed Mar 16 12:49:31 EDT 2011


I'd like to make a new algorithm based on MarchingCubes. I have been
reading the source and have two questions:

In Graphics/MarchinCubes.cxx:
496   else //multiple components - have to convert
497     {
498     int dataSize = dims[0] * dims[1] * dims[2];
499     vtkDoubleArray *image=vtkDoubleArray::New();
500     image->SetNumberOfComponents(inScalars->GetNumberOfComponents());
501     image->SetNumberOfTuples(image->GetNumberOfComponents()*dataSize);
502     inScalars->GetTuples(0,dataSize,image);
503
504     double *scalars = image->GetPointer(0);
505    
vtkMarchingCubesComputeGradient(this,scalars,dims,origin,spacing,this->Locator,
506                   newScalars,newGradients,
507                   newNormals,newPolys,values,numContours);
508     image->Delete();
509     }
510

- Is 'NumberOfComponents' needed in 501?
501     image->SetNumberOfTuples(dataSize);

- Does 504 mean that MarchingCubes is just using the first component (0)?

Thanks in advance,
-Eduardo



More information about the vtkusers mailing list