ITK/Examples/SimpleOperations/DistanceBetweenPoints: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
mNo edit summary
(Deprecated content that is moved to sphinx)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
Compute the distance between two 3D points. This can easily be extended to ND by changing the Point template parameter.
{{warning|1=The media wiki content on this page is no longer maintained.  The examples presented on the https://itk.org/Wiki/*  pages likely require ITK version 4.13 or earlier releases.   In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.
}}


==DistanceBetweenPoints.cxx==
[https://itk.org/ITKExamples[ITK Sphinx Examples]]
<source lang="cpp">
#include "itkPoint.h"
 
#include <iostream>
#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 EXIT_SUCCESS;
}
 
 
</source>
 
==CMakeLists.txt==
<source lang="cmake">
cmake_minimum_required(VERSION 2.6)
 
PROJECT(DistanceBetweenPoints)
 
FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})
 
ADD_EXECUTABLE(DistanceBetweenPoints DistanceBetweenPoints.cxx)
TARGET_LINK_LIBRARIES(DistanceBetweenPoints ITKNumerics)
 
</source>

Latest revision as of 17:08, 30 May 2019

Warning: The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases. In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.

[ITK Sphinx Examples]