(C++) BoostGeometryExample1

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) BoostGeometryExample1

 

BoostQt
CreatorLubuntu

 

Boost.Geometry example 1: determine if a point is within a polygon is a Boost.Geometry example.

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

  • STL STL: GNU ISO C++ Library, version 4.9.2

 

 

 

 

 

Qt project file: ./CppBoostGeometryExample1/CppBoostGeometryExample1.pro

 


include(../../ConsoleApplication.pri) #Or use the code below # QT += core # QT += gui # greaterThan(QT_MAJOR_VERSION, 4): QT += widgets # CONFIG   += console # CONFIG   -= app_bundle # TEMPLATE = app # CONFIG(release, debug|release) { #   DEFINES += NDEBUG NTRACE_BILDERBIKKEL # } # QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra -Weffc++ # unix { #   QMAKE_CXXFLAGS += -Werror # } include(../../Libraries/Boost.pri) #Or use the code below # win32 { #   INCLUDEPATH += \ #     ../../Libraries/boost_1_55_0 # } SOURCES += main.cpp

 

 

 

 

 

./CppBoostGeometryExample1/main.cpp

 


#include <cassert> #include <iostream> #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" #pragma GCC diagnostic ignored "-Wunused-local-typedefs" #pragma GCC diagnostic ignored "-Wunused-variable" #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #pragma GCC diagnostic pop int main() {   typedef boost::geometry::model::d2::point_xy<int> Coordinat2D;   Coordinat2D p(0,0);   const Coordinat2D p1(1,1);   const Coordinat2D p2(4,8);   boost::geometry::assign_point(p,p1);   assert(boost::geometry::equals(p,p1));   boost::geometry::add_point(p,p2);   boost::geometry::subtract_point(p,p2);   assert(boost::geometry::equals(p,p1)); }