public Range this[int axis] { get { switch (axis) { case 0: return x; case 1: return y; } throw new Exception("Unexpected index for Rect[]"); } set { switch (axis) { case 0: x = value; break; case 1: y = value; break; default: throw new Exception("Unexpected index for Rect[]"); } } }
public Rect(Vec2 min, Vec2 max) { x = new Range(min.x,max.x); y = new Range(min.y,max.y); }
public bool Intersects(Range r) { return r.Max >= Min && r.Min <= Max; }
public void Include(Range r) { Min = Math.Min(r.Min, Min); Max = Math.Max(r.Max, Max); }
public Box(Vec3 min, Vec3 max) { x = new Range(min.x,max.x); y = new Range(min.y,max.y); z = new Range(min.z,max.z); }
public Box(Range r) { x = r; y = r; z = r; }