Difference between revisions of "VTK/Examples/Cxx/Utilities/Vector"

From KitwarePublic
< VTK‎ | Examples‎ | Cxx
Jump to navigationJump to search
Line 9: Line 9:
 
{
 
{
 
   vtkVector3d v(1.0, 2.0, 3.0);
 
   vtkVector3d v(1.0, 2.0, 3.0);
   std::cout << v.X() << " " << v.Y() << " " << v.Z() << std::endl;
+
   std::cout << v.GetX() << " " << v.GetY() << " " << v.GetZ() << std::endl;
 
      
 
      
 
   double* vals = v.GetData();
 
   double* vals = v.GetData();

Revision as of 20:41, 1 October 2012

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)