Hello,I have a code piece like blew to print same returned vtkDataArray twice:
//get the normal of the representative cell
auto normal = obj->cellNormals()->GetTuple(reprenstiveCell.id);
std::cout << "Repre Cell Normals ---------- " << normal[0] << " " << normal[1] << " " << normal[3] << std::endl;
for (int i = 0; i < obj->cellNormals()->GetNumberOfTuples(); i++)
{
auto n = obj->cellNormals()->GetTuple(i);
}
std::cout << "Repre Cell Normals ---------- " << normal[0] << " " << normal[1] << " " << normal[3] << std::endl;
And the printing result likes this:
As you can see,I have an item pointer which is returned by vtkDataArray->GetTuple(idx),in the first printing,it pointed to the “10st” item,after some operations like this:
for (int i = 0; i < obj->cellNormals()->GetNumberOfTuples(); i++)
{
auto n = obj->cellNormals()->GetTuple(i);
}
It points to “11th”,why would this happen? How to use the API returned pointer properly?