CPP/Boost/Geometry/DistanceBetweenPoints

From ProgrammingExamples

< CPP
Jump to: navigation, search

DistanceBetweenPoints.cpp

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
 
#include <iostream>
 
int main ()
{
  boost::geometry::model::d2::point_xy<int> p1(1, 1), p2(2, 2);
  std::cout << "Distance p1-p2 is: " << boost::geometry::distance(p1, p2) << std::endl;
  return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
Project(DistanceBetweenPoints)
 
set(Boost_USE_MULTITHREADED ON)
FIND_PACKAGE(Boost 1.38 COMPONENTS required)
 
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${Boost_LIBRARY_DIRS})
 
ADD_EXECUTABLE(DistanceBetweenPoints DistanceBetweenPoints.cpp)
Personal tools