public bool Contained(Vector2F v) { Vector2F lv = v - Center; return((Math.Abs(lv.Dot(AxisX)) <= Extent.x) && (Math.Abs(lv.Dot(AxisY)) <= Extent.y)); }
public void Contain(Vector2F v) { Vector2F lv = v - Center; for (int k = 0; k < 2; ++k) { double t = lv.Dot(Axis(k)); if (Math.Abs(t) > Extent[k]) { double min = -Extent[k], max = Extent[k]; if (t < min) { min = t; } else if (t > max) { max = t; } Extent[k] = (float)(max - min) * 0.5f; Center = Center + ((float)(max + min) * 0.5f) * Axis(k); } } }