< Summary

Information
Class: Morpho25.Geometry.Matrix3d<T>
Assembly: Morpho25
File(s): D:\a\Morpho\Morpho\project\Morpho\Morpho25\Geometry\Matrix3d.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 25
Coverable lines: 25
Total lines: 77
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Item(...)100%10%
set_Item(...)100%10%
.ctor(...)100%10%
.ctor(...)0%60%
GetLengthX()100%10%
GetLengthY()100%10%
GetLengthZ()100%10%

File(s)

D:\a\Morpho\Morpho\project\Morpho\Morpho25\Geometry\Matrix3d.cs

#LineLine coverage
 1namespace Morpho25.Geometry
 2{
 3    /// <summary>
 4    /// Matrix 3D class.
 5    /// </summary>
 6    /// <typeparam name="T">Type to use.</typeparam>
 7    public class Matrix3d<T>
 8    {
 9        private readonly T[,,] _values;
 10
 11        /// <summary>
 12        /// Get a value.
 13        /// </summary>
 14        /// <param name="x">X index.</param>
 15        /// <param name="y">Y index.</param>
 16        /// <param name="z">Z index.</param>
 17        /// <returns>Value.</returns>
 18        public T this[int x, int y, int z]
 19        {
 020            get { return _values[x, y, z]; }
 021            set { _values[x, y, z] = value; }
 22        }
 23
 24        /// <summary>
 25        /// Create a new Matrix 3D.
 26        /// </summary>
 27        /// <param name="x">Size in X.</param>
 28        /// <param name="y">Size in Y.</param>
 29        /// <param name="z">Size in Z.</param>
 030        public Matrix3d(int x, int y, int z)
 031        {
 032            _values = new T[x, y, z];
 033        }
 34
 35        /// <summary>
 36        /// Create a new Matrix 3D.
 37        /// </summary>
 38        /// <param name="x">Size in X.</param>
 39        /// <param name="y">Size in Y.</param>
 40        /// <param name="z">Size in Z.</param>
 41        /// <param name="value">Default value to use.</param>
 042        public Matrix3d(int x, int y, int z, T value)
 043        {
 044            _values = new T[x, y, z];
 045            for (int i = 0; i < x; i++)
 046                for (int j = 0; j < y; j++)
 047                    for(int k = 0; k < z; k++)
 048                        {
 049                            _values[i, j, k] = value;
 050                        }
 051        }
 52        /// <summary>
 53        /// Get X size.
 54        /// </summary>
 55        /// <returns>X size.</returns>
 56        public int GetLengthX()
 057        {
 058            return _values.GetLength(0);
 059        }
 60        /// <summary>
 61        /// Get Y size.
 62        /// </summary>
 63        /// <returns>Y size.</returns>
 64        public int GetLengthY()
 065        {
 066            return _values.GetLength(1);
 067        }
 68        /// <summary>
 69        /// Get Z size.
 70        /// </summary>
 71        /// <returns>Z size.</returns>
 72        public int GetLengthZ()
 073        {
 074            return _values.GetLength(2);
 075        }
 76    }
 77}