[vtkusers] vtkDataSet Object
David Doria
daviddoria+vtk at gmail.com
Mon Dec 14 14:35:01 EST 2009
On Mon, Dec 14, 2009 at 2:26 PM, Naveen <a1naveen at gmail.com> wrote:
> Hi All,
>
> I have a vtkDataSet object with some X, Y, Z coordinates and certain
> POINT_DATA values. I want to add more POINT_DATA to the existing vtkDataSet
> object and change the value of Z coordinate dimension by 1. How can this be
> done?
>
> Thanks,
> Naveen
I'm not exactly sure if this is what you are asking, but this demo
shows how to add a new point as well as change an existing point:
#include <vtkPoints.h>
#include <vtkSmartPointer.h>
int main(int argc, char *argv[])
{
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
points->InsertNextPoint(0,0,0);
double p[3];
points->GetPoint(0,p);
vtkstd::cout << "p: " << p[0] << " " << p[1] << " " << p[2] << vtkstd::endl;
double newpoint[3] = {1.0, 1.0, 1.0};
points->SetPoint(0, newpoint);
double pnew[3];
points->GetPoint(0,pnew);
vtkstd::cout << "pnew: " << pnew[0] << " " << pnew[1] << " " <<
pnew[2] << vtkstd::endl;
return 0;
}
Let us know if this does not answer your question.
Thanks,
David
More information about the vtkusers
mailing list