Skip to content
PolygonCalculus.h 1.32 KiB
Newer Older
#ifndef POLYGONCALCULUS_H
#define POLYGONCALCULUS_H
Valentin Platzgummer's avatar
Valentin Platzgummer committed
#endif
#include <QPointF>
#include <QPolygonF>

#include "PlanimetryCalculus.h"
Valentin Platzgummer's avatar
Valentin Platzgummer committed
#include "OptimisationTools.h"
    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
    int              nextVertexIndex     (int pathsize, int index);
    int              previousVertexIndex (int pathsize, int index);
    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
    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);