template<> Q_INLINE_TEMPLATE QRectF _q_interpolate(const QRectF &f, const QRectF &t, qreal progress)
{
    qreal x1, y1, w1, h1;
    f.getRect(&x1, &y1, &w1, &h1);
    qreal x2, y2, w2, h2;
    t.getRect(&x2, &y2, &w2, &h2);
    return QRectF(_q_interpolate(x1, x2, progress), _q_interpolate(y1, y2, progress),
                  _q_interpolate(w1, w2, progress), _q_interpolate(h1, h2, progress));
}
Exemple #2
0
int AStarAlgorithm::numberOfIntersectingSegmentsWithAGivenRectangleBuiltByExpandingAPoint(const LineSegment *ls, const QRectF &rect)
{
   qreal x, y, w, h;
   rect.getRect(&x, &y, &w, &h);
   ldbg << "x = "<< x<< "; y = "<< y << "; w = "<< w<< "; h = "<< h<<endl;
   QList<LineSegment> sides;
   sides.append(LineSegment(x,y,x+w,y));
   sides.append(LineSegment(x,y,x,y-h));
   sides.append(LineSegment(x+w,y,x+w,y-h));
   sides.append(LineSegment(x,y-h,x+w,y-h));
   int count = 0;
   foreach(LineSegment l, sides){
       if(l.intersects(*ls))
           count++;
   }
   return count;
}