ITK/Examples/SimpleOperations/DistanceBetweenPoints

From KitwarePublic
< ITK‎ | Examples
Revision as of 01:03, 14 October 2010 by Daviddoria (talk | contribs) (Created page with "==DistanceBetweenPoints.cxx== <source lang="cpp"> #include "itkPoint.h" #include <iostream> #include <string> int main(int, char *[]) { itk::Point<double,3> p0; p0[0] = 0.0...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

DistanceBetweenPoints.cxx

<source lang="cpp">

  1. include "itkPoint.h"
  1. include <iostream>
  2. include <string>

int main(int, char *[]) {

 itk::Point<double,3> p0;
 p0[0] = 0.0;
 p0[1] = 0.0;
 p0[2] = 0.0;
 itk::Point<double,3> p1;
 p1[0] = 1.0;
 p1[1] = 1.0;
 p1[2] = 1.0;
 double dist = p0.EuclideanDistanceTo(p1);
 std::cout << "Dist: " << dist << std::endl;
 return 0;

}


</source>

CMakeLists.txt

<source lang="cmake"> cmake_minimum_required(VERSION 2.6)

PROJECT(Distance)

FIND_PACKAGE(ITK REQUIRED) INCLUDE(${ITK_USE_FILE})

ADD_EXECUTABLE(Distance Distance.cpp) TARGET_LINK_LIBRARIES(Distance ITKNumerics)


</source>