PolygonCalculus.h 1.06 KB
Newer Older
1 2 3 4
#ifndef POLYGONCALCULUS_H
#define POLYGONCALCULUS_H


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

#include "PlanimetryCalculus.h"

10 11
namespace PolygonCalculus {

12 13 14 15 16 17 18 19 20 21 22 23
    enum JoinPolygonError { NotSimplePolygon, PolygonJoined, Disjoint, PathSizeLow};

    int              closestVertexIndex  (const QPolygonF &polygon, const QPointF &coordinate);
    QPointF          closestVertex       (const QPolygonF &polygon, const QPointF &coordinate);
    int              nextPolygonIndex    (int pathsize, int index);
    int              previousPolygonIndex(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);
    bool             offsetPolygon       (QPolygonF &polygon, double offset);
    double           distanceInsidePolygon (const QPointF &c1, const QPointF &c2, QPolygonF polygon);
24 25 26
}

#endif // POLYGONCALCULUS_H