PolygonCalculus.h 1.32 KB
Newer Older
1 2
#ifndef POLYGONCALCULUS_H
#define POLYGONCALCULUS_H
Valentin Platzgummer's avatar
Valentin Platzgummer committed
3
#endif
4 5


6 7 8 9
#include <QPointF>
#include <QPolygonF>

#include "PlanimetryCalculus.h"
Valentin Platzgummer's avatar
Valentin Platzgummer committed
10
#include "OptimisationTools.h"
11

12 13
namespace PolygonCalculus {

14 15 16 17
    enum JoinPolygonError { NotSimplePolygon, PolygonJoined, Disjoint, PathSizeLow};

    int              closestVertexIndex  (const QPolygonF &polygon, const QPointF &coordinate);
    QPointF          closestVertex       (const QPolygonF &polygon, const QPointF &coordinate);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
18 19
    int              nextVertexIndex     (int pathsize, int index);
    int              previousVertexIndex (int pathsize, int index);
20 21 22 23
    JoinPolygonError joinPolygon         (QPolygonF polygon1, QPolygonF polygon2, QPolygonF &joinedPolygon);
    bool             isSimplePolygon     (const QPolygonF &polygon);
    bool             hasClockwiseWinding (const QPolygonF &path);
    void             reversePath         (QPolygonF &path);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
24 25 26 27
    void             offsetPolygon       (QPolygonF &polygon, double offset);
    bool             containsPath        (QPolygonF polygon, const QPointF &c1, const QPointF &c2);
    void             decomposeToConvex   (const QPolygonF &polygon, QList<QPolygon> &convexPolygons);
    bool             shortestPath        (const QPolygonF &polygon, const QPointF &startVertex, const QPointF &endVertex, QList<QPointF> &shortestPath);
28 29
}

Valentin Platzgummer's avatar
Valentin Platzgummer committed
30