25 static SCR_Rect2D FromPoints(vector lowerPoint, vector higherPoint)
35 static SCR_Rect2D FromPosAndSize(vector pos, vector size)
41 r.p1[0] = pos[0] + size[0];
42 r.p1[1] = pos[1] + size[1];
63 return (other.p0[0] >= p0[0]) &&
64 (other.p0[1] >= p0[1]) &&
65 (other.p1[0] <= p1[0]) &&
66 (other.p1[1] <= p1[1]);
71 bool HasInside(vector point)
75 return (x >= p0[0]) && (x <= p1[0]) && (y >= p0[1]) && (y <= p1[1]);
82 return CheckIntervalIntersection(p0[0], p1[0], other.p0[0], other.p1[0]) &&
83 CheckIntervalIntersection(p0[1], p1[1], other.p0[1], other.p1[1]);
93 v[0] = 0.5 * (p0[0] + p1[0]);
94 v[1] = 0.5 * (p0[1] + p1[1]);
102 return p1[0] - p0[0];
108 return p1[1] - p0[1];
113 protected static bool CheckIntervalIntersection(
float aMin,
float aMax,
float bMin,
float bMax)
115 if ((bMin > aMax) || (bMax < aMin))
126 p0[0] = p0[0] - delta;
127 p0[1] = p0[1] - delta;
128 p1[0] = p1[0] + delta;
129 p1[1] = p1[1] + delta;