/// <summary> /// Resizes the bounds to fit another bounds. /// </summary> /// <param name="other"> Another <see cref="Bounds"/> that needs to fit in this one. </param> public void Resize(Bounds other) { if (other.Minima != null) { if (isSet) // the bounds have already been set { minima.KeepMinima(other.Minima); maxima.KeepMaxima(other.Maxima); } else // the bounds haven't been set { isSet = true; minima = other.Minima.Copy(); maxima = other.Maxima.Copy(); } } }
/// <summary> /// Computes the transform to go from bounds1 to bounds2. /// </summary> /// <param name="bounds1"></param> /// <param name="bounds2"></param> public void Compute(Bounds bounds1, Bounds bounds2) { Scaling = bounds2.Size / bounds1.Size; Offset = (bounds2.Minima - bounds1.Minima*Scaling); }