geometry.h
author insilmaril
Wed Oct 29 17:42:34 2008 +0000 (2008-10-29)
changeset 727 96402b172173
parent 656 53ef954e90b6
child 754 db0ec4bcf416
permissions -rw-r--r--
subtrees can be deleted now
     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