#include <assert.h>
#include "math/vector.hpp"
+#include "object/anchor_point.hpp"
/** This class represents a rectangle.
* (Implementation Note) We're using upper left and lower right point instead of
return true;
}
+ float distance (const Vector& other, AnchorPoint ap = ANCHOR_MIDDLE) const
+ {
+ Vector v = get_anchor_pos (*this, ap);
+ return ((v - other).norm ());
+ }
+
+ float distance (const Rectf& other, AnchorPoint ap = ANCHOR_MIDDLE) const
+ {
+ Vector v1 = get_anchor_pos (*this, ap);
+ Vector v2 = get_anchor_pos (other, ap);
+
+ return ((v1 - v2).norm ());
+ }
+
// leave these two public to save the headaches of set/get functions for such
// simple things :)