/// <summary> /// Copies values from a matrix of equal size. /// </summary> /// <param name="other">A matrix to copy from.</param> public void CopyFrom(Matrix3D <T> other) { if (other.GetLength(0) != GetLength(0) || other.GetLength(1) != GetLength(1) || other.GetLength(2) != GetLength(2)) { throw new ArgumentException("The other matrix does not have the same size!"); } for (int x = 0; x < other.GetLength(0); x++) { for (int y = 0; y < other.GetLength(1); y++) { for (int z = 0; z < other.GetLength(2); z++) { this[x, y, z] = other[x, y, z]; } } } }
// Creates a copy of another vector of the same type public Matrix3D(Matrix3D <T> other) { Contents = new T[other.GetLength(0), other.GetLength(1), other.GetLength(2)]; CopyFrom(other); }