2 #include "oxygine-include.h" 21 bool overlaps1Way(
const OBBox& other)
const 23 for (
int a = 0; a < 2; ++a)
26 float t = other.corner[0].dot(axis[a]);
32 for (
int c = 1; c < 4; ++c)
34 t = other.corner[c].dot(axis[a]);
49 if ((tMin > 1 + origin[a]) || (tMax < origin[a]))
67 axis[0] = corner[1] - corner[0];
68 axis[1] = corner[3] - corner[0];
73 for (
int a = 0; a < 2; ++a)
75 axis[a] /= axis[a].sqlength();
76 origin[a] = corner[0].dot(axis[a]);
82 OBBox(
const RectF& rect,
const AffineTransform& tr)
84 corner[0] = tr.transform(rect.getLeftTop());
85 corner[1] = tr.transform(rect.getRightTop());
86 corner[2] = tr.transform(rect.getRightBottom());
87 corner[3] = tr.transform(rect.getLeftBottom());
95 return overlaps1Way(other) && other.overlaps1Way(*
this);
101 rect.unite(corner[1]);
102 rect.unite(corner[2]);
103 rect.unite(corner[3]);
–oxgl-end–!
Definition: Actor.h:14
bool overlaps(const OBBox &other) const
Definition: OBBox.h:93