public Bound3(Bound1 x, Bound1 y, Bound1 z) { this.x = x; this.y = y; this.z = z; }
public static Bound1 Move(Bound1 bound, float delta) { bound.min += delta; bound.max += delta; return bound; }
/// <summary> /// 扩展以包含指定范围 /// </summary> public void Encapsulate(Bound1 other) { if (other.min < min) min = other.min; if (other.max > max) max = other.max; }
/// <summary> /// 获取两个范围的交集 /// </summary> public Bound1 GetIntersection(Bound1 other) { if (min > other.min) other.min = min; if (max < other.max) other.max = max; return other; }
/// <summary> /// 判断是否与另一范围有交集 /// </summary> public bool Intersects(Bound1 other) { return min <= other.max && max >= other.min; }
/// <summary> /// 使用两个轴的范围构造二维范围 /// </summary> public Bound2(Bound1 x, Bound1 y) { this.x = x; this.y = y; }