< Summary

Information
Class: MorphoGeometry.BoundaryBox
Assembly: MorphoGeometry
File(s): D:\a\Morpho\Morpho\project\Morpho\MorphoGeometry\BoundaryBox.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 28
Coverable lines: 28
Total lines: 59
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_MinPoint()100%10%
get_MaxPoint()100%10%
.ctor(...)0%20%

File(s)

D:\a\Morpho\Morpho\project\Morpho\MorphoGeometry\BoundaryBox.cs

#LineLine coverage
 1using System.Linq;
 2
 3namespace MorphoGeometry
 4{
 5    /// <summary>
 6    /// Boundary box class.
 7    /// </summary>
 8    public class BoundaryBox
 9    {
 10        private const int NUM_VERT = 3;
 11
 12        /// <summary>
 13        /// Lower left point.
 14        /// </summary>
 015        public Vector MinPoint { get; }
 16
 17        /// <summary>
 18        /// Upper right point.
 19        /// </summary>
 020        public Vector MaxPoint { get; }
 21
 22        /// <summary>
 23        /// Create a new boundary box.
 24        /// </summary>
 25        /// <param name="facegroup">Facegroup.</param>
 026        public BoundaryBox(FaceGroup facegroup)
 027        {
 028            float[] coordinateX = new float[facegroup.Faces.Count * NUM_VERT];
 029            float[] coordinateY = new float[facegroup.Faces.Count * NUM_VERT];
 030            float[] coordinateZ = new float[facegroup.Faces.Count * NUM_VERT];
 31
 032            for (int i = 0; i < facegroup.Faces.Count; i++)
 033            {
 034                coordinateX[i] = facegroup.Faces[i].A.x;
 035                coordinateX[i] = facegroup.Faces[i].B.x;
 036                coordinateX[i] = facegroup.Faces[i].C.x;
 37
 038                coordinateY[i] = facegroup.Faces[i].A.y;
 039                coordinateY[i] = facegroup.Faces[i].B.y;
 040                coordinateY[i] = facegroup.Faces[i].C.y;
 41
 042                coordinateZ[i] = facegroup.Faces[i].A.z;
 043                coordinateZ[i] = facegroup.Faces[i].B.z;
 044                coordinateZ[i] = facegroup.Faces[i].C.z;
 045            }
 46
 047            float minX = coordinateX.Min();
 048            float minY = coordinateY.Min();
 049            float minZ = coordinateZ.Min();
 50
 051            float maxX = coordinateX.Max();
 052            float maxY = coordinateY.Max();
 053            float maxZ = coordinateZ.Max();
 54
 055            MinPoint = new Vector(minX, minY, minZ);
 056            MaxPoint = new Vector(maxX, maxY, maxZ);
 057        }
 58    }
 59}