/// <summary> /// set this box to the bounding box of this and point /// </summary> public void Include([NotNull] Pnt point, int dimension) { if (Min == Max) { Min = Min.ClonePnt(); Max = Max.ClonePnt(); } for (var i = 0; i < dimension; i++) { if (point[i] < Min[i]) { Min[i] = point[i]; } else if (point[i] > Max[i]) { Max[i] = point[i]; } } }
/// <summary> /// set this box to the bounding box of this and box /// </summary> /// <param name="box"></param> /// <param name="dimension"></param> public void Include([NotNull] IBox box, int dimension) { if (Min == Max) { Min = Min.ClonePnt(); Max = Max.ClonePnt(); } for (var i = 0; i < dimension; i++) { if (box.Min[i] < Min[i]) { Min[i] = box.Min[i]; } if (box.Max[i] > Max[i]) { Max[i] = box.Max[i]; } } }
public Box Clone() { return(new Box(Min.ClonePnt(), Max.ClonePnt())); }