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
     1 #ifndef GEOMETRY_H
     2 #define GEOMETRY_H
     3 
     4 #include <QPointF>
     5 #include <QRectF>
     6 #include <QPolygonF>
     7 
     8 QRectF addBBox(QRectF r1, QRectF r2);
     9 bool inBox(const QPointF &p, const QRectF &box);
    10 
    11 QPointF normalize (const QPointF &p);
    12 
    13 
    14 qreal dotProduct (const QPointF &a, const QPointF &b);
    15 
    16 class PolygonCollisionResult {
    17 public:
    18     // Are the polygons going to intersect forward in time?
    19     bool willIntersect;
    20 
    21     // Are the polygons currently intersecting?
    22     bool intersect;
    23 
    24     // The translation to apply to the first polygon to push the polygons apart.
    25     QPointF minTranslation;
    26 };
    27 
    28 
    29 void ProjectPolygon(QPointF axis, QPolygonF polygon, qreal &min, qreal &max) ;
    30 qreal intervalDistance(qreal minA, qreal maxA, qreal minB, qreal maxB);
    31 PolygonCollisionResult PolygonCollision(QPolygonF polygonA, 
    32                               QPolygonF polygonB, QPointF velocity);
    33 
    34 #endif