Commit 2601b482 authored by Valentin Platzgummer's avatar Valentin Platzgummer

SnakeWorker added

parent 5ac59ffd
......@@ -92,11 +92,6 @@ exists($$MAVLINKPATH/common) {
INCLUDEPATH += libs/eigen
# [REQUIRED] snake library (Wima)
INCLUDEPATH += libs/snake
INCLUDEPATH += libs/or-tools/include
# [REQUIRED] shapelib library
INCLUDEPATH += libs/shapelib
......@@ -200,3 +195,13 @@ contains (DEFINES, DISABLE_AIRMAP) {
# GeograpicLib (TODO: add Windows support!)
LinuxBuild {
LIBS += -L/usr/local/lib -lGeographic #
# google or-tools (TODO: add Windows support!)
LinuxBuild {
LIBS += -L/usr/local/lib -lortools #
cmake_minimum_required(VERSION 3.14)
target_include_directories(polyclipping PUBLIC include)
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.18
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
# Disable VCS-based implicit rules.
% : %,v
# Disable VCS-based implicit rules.
% : RCS/%
# Disable VCS-based implicit rules.
% : RCS/%,v
# Disable VCS-based implicit rules.
% : SCCS/s.%
# Disable VCS-based implicit rules.
% : s.%
.SUFFIXES: .hpux_make_needs_suffix_list
# Command-line flag to silence nested $(MAKE).
# Suppress display of executed commands.
# A target that is always out of date.
.PHONY : cmake_force
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/local/bin/cmake
# The command to remove a file.
RM = /usr/local/bin/cmake -E rm -f
# Escaping for special characters.
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/valentin/Desktop/drones/qgroundcontrol
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/valentin/Desktop/drones/qgroundcontrol
# Targets provided globally by CMake.
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/local/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/local/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip/fast
# Special rule for the target edit_cache
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
/usr/local/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/local/bin/cmake -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/local/bin/cmake -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target rebuild_cache
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/local/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# Special rule for the target list_install_components
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/local/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/local/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local/fast
# The main all target
all: cmake_check_build_system
cd /home/valentin/Desktop/drones/qgroundcontrol && $(CMAKE_COMMAND) -E cmake_progress_start /home/valentin/Desktop/drones/qgroundcontrol/CMakeFiles /home/valentin/Desktop/drones/qgroundcontrol/libs/clipper//CMakeFiles/progress.marks
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 libs/clipper/all
$(CMAKE_COMMAND) -E cmake_progress_start /home/valentin/Desktop/drones/qgroundcontrol/CMakeFiles 0
.PHONY : all
# The main clean target
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 libs/clipper/clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 libs/clipper/preinstall
.PHONY : preinstall
# Prepare targets for installation.
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 libs/clipper/preinstall
.PHONY : preinstall/fast
# clear depends
cd /home/valentin/Desktop/drones/qgroundcontrol && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
# Convenience name for target.
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 libs/clipper/CMakeFiles/polyclipping.dir/rule
.PHONY : libs/clipper/CMakeFiles/polyclipping.dir/rule
# Convenience name for target.
polyclipping: libs/clipper/CMakeFiles/polyclipping.dir/rule
.PHONY : polyclipping
# fast build rule for target.
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f libs/clipper/CMakeFiles/polyclipping.dir/build.make libs/clipper/CMakeFiles/polyclipping.dir/build
.PHONY : polyclipping/fast
# Convenience name for target.
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 libs/clipper/CMakeFiles/polyclipping_autogen.dir/rule
.PHONY : libs/clipper/CMakeFiles/polyclipping_autogen.dir/rule
# Convenience name for target.
polyclipping_autogen: libs/clipper/CMakeFiles/polyclipping_autogen.dir/rule
.PHONY : polyclipping_autogen
# fast build rule for target.
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f libs/clipper/CMakeFiles/polyclipping_autogen.dir/build.make libs/clipper/CMakeFiles/polyclipping_autogen.dir/build
.PHONY : polyclipping_autogen/fast
clipper.o: clipper.cpp.o
.PHONY : clipper.o
# target to build an object file
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f libs/clipper/CMakeFiles/polyclipping.dir/build.make libs/clipper/CMakeFiles/polyclipping.dir/clipper.cpp.o
.PHONY : clipper.cpp.o
clipper.i: clipper.cpp.i
.PHONY : clipper.i
# target to preprocess a source file
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f libs/clipper/CMakeFiles/polyclipping.dir/build.make libs/clipper/CMakeFiles/polyclipping.dir/clipper.cpp.i
.PHONY : clipper.cpp.i
clipper.s: clipper.cpp.s
.PHONY : clipper.s
# target to generate assembly for a file
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f libs/clipper/CMakeFiles/polyclipping.dir/build.make libs/clipper/CMakeFiles/polyclipping.dir/clipper.cpp.s
.PHONY : clipper.cpp.s
polyclipping_autogen/mocs_compilation.o: polyclipping_autogen/mocs_compilation.cpp.o
.PHONY : polyclipping_autogen/mocs_compilation.o
# target to build an object file
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f libs/clipper/CMakeFiles/polyclipping.dir/build.make libs/clipper/CMakeFiles/polyclipping.dir/polyclipping_autogen/mocs_compilation.cpp.o
.PHONY : polyclipping_autogen/mocs_compilation.cpp.o
polyclipping_autogen/mocs_compilation.i: polyclipping_autogen/mocs_compilation.cpp.i
.PHONY : polyclipping_autogen/mocs_compilation.i
# target to preprocess a source file
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f libs/clipper/CMakeFiles/polyclipping.dir/build.make libs/clipper/CMakeFiles/polyclipping.dir/polyclipping_autogen/mocs_compilation.cpp.i
.PHONY : polyclipping_autogen/mocs_compilation.cpp.i
polyclipping_autogen/mocs_compilation.s: polyclipping_autogen/mocs_compilation.cpp.s
.PHONY : polyclipping_autogen/mocs_compilation.s
# target to generate assembly for a file
cd /home/valentin/Desktop/drones/qgroundcontrol && $(MAKE) $(MAKESILENT) -f libs/clipper/CMakeFiles/polyclipping.dir/build.make libs/clipper/CMakeFiles/polyclipping.dir/polyclipping_autogen/mocs_compilation.cpp.s
.PHONY : polyclipping_autogen/mocs_compilation.cpp.s
# Help Target
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... install/strip"
@echo "... list_install_components"
@echo "... rebuild_cache"
@echo "... polyclipping_autogen"
@echo "... polyclipping"
@echo "... clipper.o"
@echo "... clipper.i"
@echo "... clipper.s"
@echo "... polyclipping_autogen/mocs_compilation.o"
@echo "... polyclipping_autogen/mocs_compilation.i"
@echo "... polyclipping_autogen/mocs_compilation.s"
.PHONY : help
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cd /home/valentin/Desktop/drones/qgroundcontrol && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
# qtcreator generated files
# xemacs temporary files
# Vim temporary files
# Visual Studio generated files
# MinGW generated files
# Python byte code
# Binaries
# --------
This source diff could not be displayed because it is too large. You can view the blob instead.
* *
* Author : Angus Johnson *
* Version : 6.4.2 *
* Date : 27 February 2017 *
* Website : *
* Copyright : Angus Johnson 2010-2017 *
* *
* License: *
* Use, modification & distribution is subject to Boost Software License Ver 1. *
* *
* *
* Attributions: *
* The code in this library is an extension of Bala Vatti's clipping algorithm: *
* "A generic solution to polygon clipping" *
* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. *
* *
* *
* Computer graphics and geometric modeling: implementation and algorithms *
* By Max K. Agoston *
* Springer; 1 edition (January 4, 2005) *
* *
* *
* See also: *
* "Polygon Offsetting by Computing Winding Numbers" *
* Paper no. DETC2005-85513 pp. 565-575 *
* ASME 2005 International Design Engineering Technical Conferences *
* and Computers and Information in Engineering Conference (IDETC/CIE2005) *
* September 24-28, 2005 , Long Beach, California, USA *
* *
* *
#ifndef clipper_hpp
#define clipper_hpp
#define CLIPPER_VERSION "6.4.2"
//use_int32: When enabled 32bit ints are used instead of 64bit ints. This
//improve performance but coordinate values are limited to the range +/- 46340
//#define use_int32
//use_xyz: adds a Z member to IntPoint. Adds a minor cost to perfomance.
//#define use_xyz
//use_lines: Enables line clipping. Adds a very minor cost to performance.
#define use_lines
//use_deprecated: Enables temporary support for the obsolete functions
//#define use_deprecated
#include <vector>
#include <list>
#include <set>
#include <stdexcept>
#include <cstring>
#include <cstdlib>
#include <ostream>
#include <functional>
#include <queue>
namespace ClipperLib {
enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
enum PolyType { ptSubject, ptClip };
//By far the most widely used winding rules for polygon filling are
//EvenOdd & NonZero (GDI, GDI+, XLib, OpenGL, Cairo, AGG, Quartz, SVG, Gr32)
//Others rules include Positive, Negative and ABS_GTR_EQ_TWO (only in OpenGL)
enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative };
#ifdef use_int32
typedef int cInt;
static cInt const loRange = 0x7FFF;
static cInt const hiRange = 0x7FFF;
typedef signed long long cInt;
static cInt const loRange = 0x3FFFFFFF;
static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL;
typedef signed long long long64; //used by Int128 class
typedef unsigned long long ulong64;
struct IntPoint {
cInt X;
cInt Y;
#ifdef use_xyz
cInt Z;
IntPoint(cInt x = 0, cInt y = 0, cInt z = 0): X(x), Y(y), Z(z) {};
IntPoint(cInt x = 0, cInt y = 0): X(x), Y(y) {};
friend inline bool operator== (const IntPoint& a, const IntPoint& b)
return a.X == b.X && a.Y == b.Y;
friend inline bool operator!= (const IntPoint& a, const IntPoint& b)
return a.X != b.X || a.Y != b.Y;
typedef std::vector< IntPoint > Path;
typedef std::vector< Path > Paths;
inline Path& operator <<(Path& poly, const IntPoint& p) {poly.push_back(p); return poly;}
inline Paths& operator <<(Paths& polys, const Path& p) {polys.push_back(p); return polys;}
std::ostream& operator <<(std::ostream &s, const IntPoint &p);
std::ostream& operator <<(std::ostream &s, const Path &p);
std::ostream& operator <<(std::ostream &s, const Paths &p);
struct DoublePoint
double X;
double Y;
DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {}
DoublePoint(IntPoint ip) : X((double)ip.X), Y((double)ip.Y) {}
#ifdef use_xyz
typedef void (*ZFillCallback)(IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt);
enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4};
enum JoinType {jtSquare, jtRound, jtMiter};
enum EndType {etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare, etOpenRound};
class PolyNode;
typedef std::vector< PolyNode* > PolyNodes;
class PolyNode
virtual ~PolyNode(){};
Path Contour;
PolyNodes Childs;
PolyNode* Parent;
PolyNode* GetNext() const;
bool IsHole() const;
bool IsOpen() const;
int ChildCount() const;
//PolyNode& operator =(PolyNode& other);
unsigned Index; //node index in Parent.Childs
bool m_IsOpen;
JoinType m_jointype;
EndType m_endtype;
PolyNode* GetNextSiblingUp() const;
void AddChild(PolyNode& child);
friend class Clipper; //to access Index
friend class ClipperOffset;
class PolyTree: public PolyNode
~PolyTree(){ Clear(); };
PolyNode* GetFirst() const;
void Clear();
int Total() const;
//PolyTree& operator =(PolyTree& other);
PolyNodes AllNodes;
friend class Clipper; //to access AllNodes
bool Orientation(const Path &poly);
double Area(const Path &poly);
int PointInPolygon(const IntPoint &pt, const Path &path);
void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd);
void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1.415);
void CleanPolygon(Path& poly, double distance = 1.415);
void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415);
void CleanPolygons(Paths& polys, double distance = 1.415);
void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed);
void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed);
void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution);
void PolyTreeToPaths(const PolyTree& polytree, Paths& paths);
void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths);
void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths);
void ReversePath(Path& p);
void ReversePaths(Paths& p);
struct IntRect { cInt left; cInt top; cInt right; cInt bottom; };
//enums that are used internally ...
enum EdgeSide { esLeft = 1, esRight = 2};
//forward declarations (for stuff used internally) ...
struct TEdge;
struct IntersectNode;
struct LocalMinimum;
struct OutPt;
struct OutRec;
struct Join;
typedef std::vector < OutRec* > PolyOutList;
typedef std::vector < TEdge* > EdgeList;
typedef std::vector < Join* > JoinList;
typedef std::vector < IntersectNode* > IntersectList;
//ClipperBase is the ancestor to the Clipper class. It should not be
//instantiated directly. This class simply abstracts the conversion of sets of
//polygon coordinates into edge objects that are stored in a LocalMinima list.
class ClipperBase
virtual ~ClipperBase();
virtual bool AddPath(const Path &pg, PolyType PolyTyp, bool Closed);
bool AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed);
virtual void Clear();
IntRect GetBounds();
bool PreserveCollinear() {return m_PreserveCollinear;};
void PreserveCollinear(bool value) {m_PreserveCollinear = value;};
void DisposeLocalMinimaList();
TEdge* AddBoundsToLML(TEdge *e, bool IsClosed);
virtual void Reset();
TEdge* ProcessBound(TEdge* E, bool IsClockwise);
void InsertScanbeam(const cInt Y);
bool PopScanbeam(cInt &Y);
bool LocalMinimaPending();
bool PopLocalMinima(cInt Y, const LocalMinimum *&locMin);
OutRec* CreateOutRec();
void DisposeAllOutRecs();
void DisposeOutRec(PolyOutList::size_type index);
void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2);
void DeleteFromAEL(TEdge *e);
void UpdateEdgeIntoAEL(TEdge *&e);
typedef std::vector<LocalMinimum> MinimaList;
MinimaList::iterator m_CurrentLM;
MinimaList m_MinimaList;
bool m_UseFullRange;
EdgeList m_edges;
bool m_PreserveCollinear;
bool m_HasOpenPaths;
PolyOutList m_PolyOuts;
TEdge *m_ActiveEdges;
typedef std::priority_queue<cInt> ScanbeamList;
ScanbeamList m_Scanbeam;