VTK/Examples/Cxx/Utilities/Vector

From KitwarePublic
< VTK‎ | Examples‎ | Cxx
Jump to navigationJump to search

Vector.cxx

#include <vtkSmartPointer.h>
#include <vtkVector.h>

#include <iostream>

int main(int, char *[])
{
  vtkVector3d v(1.0, 2.0, 3.0);
  std::cout << v.GetX() << " " << v.GetY() << " " << v.GetZ() << std::endl;
    
  double* vals = v.GetData();
  
  std::cout << vals[0] << " " << vals[1] << " " << vals[2] << std::endl;
  
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
PROJECT(Vector)

FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})

ADD_EXECUTABLE(Vector Vector.cxx)
TARGET_LINK_LIBRARIES(Vector vtkHybrid)