Is there any reason , you do not want to const_cast it?<div><br></div><div>REgards<br><br><div class="gmail_quote">On Mon, Oct 8, 2012 at 12:37 PM, Nico Schlömer <span dir="ltr"><<a href="mailto:nico.schloemer@gmail.com" target="_blank">nico.schloemer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I have a const double array<br>
<br>
const double * myPointCoordinates;<br>
<br>
and would like to feed it into a VTK unstructured grid as points. I'd<br>
like to pass around the points so what I'm doing is<br>
<br>
// Build VTK unstructured grid object.<br>
vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid =<br>
vtkSmartPointer<vtkUnstructuredGrid>::New();<br>
// Set the points.<br>
const int numPoints = mesh.num_vertices();<br>
vtkSmartPointer<vtkDoubleArray> pointData =<br>
vtkSmartPointer<vtkDoubleArray>::New();<br>
pointData->SetNumberOfComponents(3);<br>
pointData->SetArray(myPointCoordinates, 3*numPoints, 1);<br>
vtkSmartPointer<vtkPoints> points =<br>
vtkSmartPointer<vtkPoints>::New();<br>
points->SetData(pointData);<br>
unstructuredGrid->SetPoints(points);<br>
<br>
This is almost working except for the fact that myPointCoordinates is<br>
const, and the first argument of SetArray() isn't.<br>
Is there a way around this?<br>
<br>
--Nico<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>