geometry.h
author insilmaril
Wed, 03 Jun 2009 20:37:17 +0000
changeset 775 6e4b586aa88a
parent 754 db0ec4bcf416
child 789 d85834ad8c54
permissions -rw-r--r--
Unscrolling temporary works again
     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 isInBox(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