[vtkusers] SetArray(const, , )
Nico Schlömer
nico.schloemer at gmail.com
Mon Oct 8 12:42:51 EDT 2012
That works. Thanks!
--Nico
On Mon, Oct 8, 2012 at 6:42 PM, Darshan Pai <darshanpai at gmail.com> wrote:
> Is there any reason , you do not want to const_cast it?
>
> REgards
>
> On Mon, Oct 8, 2012 at 12:37 PM, Nico Schlömer <nico.schloemer at gmail.com>
> wrote:
>>
>> 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
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list