Skip to content
PolygonCalculus.h 1.06 KiB
Newer Older
#ifndef POLYGONCALCULUS_H
#define POLYGONCALCULUS_H


#include <QPointF>
#include <QPolygonF>

#include "PlanimetryCalculus.h"

    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);