geometry.h
author insilmaril
Fri, 11 Jul 2008 12:36:39 +0000
changeset 715 c7f2d53c98d1
parent 662 9abdd5e6c3dc
child 754 db0ec4bcf416
permissions -rw-r--r--
Fix for umlauts in paths
insilmaril@650
     1
#ifndef GEOMETRY_H
insilmaril@650
     2
#define GEOMETRY_H
insilmaril@650
     3
insilmaril@656
     4
#include <QPointF>
insilmaril@650
     5
#include <QRectF>
insilmaril@656
     6
#include <QPolygonF>
insilmaril@650
     7
insilmaril@650
     8
QRectF addBBox(QRectF r1, QRectF r2);
insilmaril@650
     9
bool inBox(const QPointF &p, const QRectF &box);
insilmaril@650
    10
insilmaril@656
    11
QPointF normalize (const QPointF &p);
insilmaril@650
    12
insilmaril@662
    13
insilmaril@662
    14
qreal dotProduct (const QPointF &a, const QPointF &b);
insilmaril@662
    15
insilmaril@662
    16
class PolygonCollisionResult {
insilmaril@662
    17
public:
insilmaril@662
    18
    // Are the polygons going to intersect forward in time?
insilmaril@662
    19
    bool willIntersect;
insilmaril@662
    20
insilmaril@662
    21
    // Are the polygons currently intersecting?
insilmaril@662
    22
    bool intersect;
insilmaril@662
    23
insilmaril@662
    24
    // The translation to apply to the first polygon to push the polygons apart.
insilmaril@662
    25
    QPointF minTranslation;
insilmaril@662
    26
};
insilmaril@662
    27
insilmaril@662
    28
insilmaril@662
    29
void ProjectPolygon(QPointF axis, QPolygonF polygon, qreal &min, qreal &max) ;
insilmaril@662
    30
qreal intervalDistance(qreal minA, qreal maxA, qreal minB, qreal maxB);
insilmaril@662
    31
PolygonCollisionResult PolygonCollision(QPolygonF polygonA, 
insilmaril@662
    32
                              QPolygonF polygonB, QPointF velocity);
insilmaril@662
    33
insilmaril@650
    34
#endif