[vtkusers] SetArray(const, , )
    Nico Schlömer 
    nico.schloemer at gmail.com
       
    Mon Oct  8 12:37:38 EDT 2012
    
    
  
Hi,
I have a const double array
  const double * myPointCoordinates;
and would like to feed it into a VTK unstructured grid as points. I'd
like to pass around the points so what I'm doing is
  // Build VTK unstructured grid object.
  vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid =
    vtkSmartPointer<vtkUnstructuredGrid>::New();
  // Set the points.
  const int numPoints = mesh.num_vertices();
  vtkSmartPointer<vtkDoubleArray> pointData =
    vtkSmartPointer<vtkDoubleArray>::New();
  pointData->SetNumberOfComponents(3);
  pointData->SetArray(myPointCoordinates, 3*numPoints, 1);
  vtkSmartPointer<vtkPoints> points =
    vtkSmartPointer<vtkPoints>::New();
  points->SetData(pointData);
  unstructuredGrid->SetPoints(points);
This is almost working except for the fact that myPointCoordinates is
const, and the first argument of SetArray() isn't.
Is there a way around this?
--Nico
    
    
More information about the vtkusers
mailing list