ITK/Examples/Math/DotProduct

From KitwarePublic

Jump to: navigation, search

DotProduct.cxx

#include <itkVector.h>
 
int main(int, char*[])
{
  typedef itk::Vector<double, 3> VectorType;
 
  VectorType v1;
  v1[0] = 1.0;
  v1[1] = 2.0;
  v1[2] = 3.0;
 
  VectorType v2;
  v2[0] = 1.0;
  v2[1] = 2.0;
  v2[2] = 3.0;
 
  VectorType dotproduct = v1*v2;
  std::cout << "dot(v1,v2): " << dotproduct << std::endl;
 
  return EXIT_SUCCESS;
}


CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
 
project(DotProduct)
 
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
 
add_executable(DotProduct DotProduct.cxx)
 
if( "${ITK_VERSION_MAJOR}" LESS 4 )
  target_link_libraries(DotProduct ITKReview ${ITK_LIBRARIES})
else( "${ITK_VERSION_MAJOR}" LESS 4 )
  target_link_libraries(DotProduct ${ITK_LIBRARIES})
endif( "${ITK_VERSION_MAJOR}" LESS 4 )
Personal tools