Difference between revisions of "VTK/Examples/Cxx/Utilities/2DArray"

From KitwarePublic
< VTK‎ | Examples‎ | Cxx
Jump to: navigation, search
Line 1: Line 1:
This example creates a 5x5 2D array and sets the (4,4) (zero based indexing, of course) entry to 5.0. Then it outputs this value to demonstrate accessing.
= '''See [https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/2DArray 2DArray] on the new [https://lorensen.github.io/VTKExamples/site/ VTKExamples website].''' =
<source lang="cpp">
#include <vtkSmartPointer.h>
#include <vtkDenseArray.h>
int main(int, char *[])
  vtkSmartPointer<vtkDenseArray<double> > array =
    vtkSmartPointer<vtkDenseArray<double> >::New();
  array->SetValue(4,4, 5.0);
  std::cout << array->GetValue(4,4) << std::endl;
  return EXIT_SUCCESS;

Latest revision as of 19:30, 19 February 2019

See 2DArray on the new VTKExamples website.