rect.h revision 981b809bc6ed10a21e89444d9447e5475801874f
//D2<Interval> specialization to Rect:
/* Authors of original rect class:
* Lauris Kaplinski <lauris@kaplinski.com>
* Nathan Hurst <njh@mail.csse.monash.edu.au>
* bulia byak <buliabyak@users.sf.net>
* MenTaLguY <mental@rydia.net>
*/
#ifdef _2GEOM_D2 /*This is intentional: we don't actually want anyone to
include this, other than D2.h */
#ifndef _2GEOM_RECT
#define _2GEOM_RECT
#include "matrix.h"
template<>
Interval f[2];
f[X] = a;
f[Y] = b;
}
f[X] = Interval(a[X], b[X]);
f[Y] = Interval(a[Y], b[Y]);
}
/** returns the four corners of the rectangle in order
* (clockwise if +Y is up, anticlockwise if +Y is down) */
switch(i % 4) {
}
}
/** returns a vector from min to max. */
inline bool intersects(Rect const &r) const { return f[X].intersects(r[X]) && f[Y].intersects(r[Y]); }
/** Transforms the rect by m. Note that it gives correct results only for scales and translates,
in the case of rotations, the area of the rect will grow as it cannot rotate. */
};
}
}
}
#endif //_2GEOM_RECT
#endif //_2GEOM_D2