Changeset 15554 for branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ResidualSpaceCalculation/ResidualSpaceCalculator.cs
- Timestamp:
- 12/20/17 16:15:38 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ResidualSpaceCalculation/ResidualSpaceCalculator.cs
r15520 r15554 10 10 11 11 internal ResidualSpaceCalculator() {} 12 12 13 13 public IEnumerable<ResidualSpace> CalculateResidualSpaces(BinPacking3D binPacking, Vector3D point) { 14 14 IList<ResidualSpace> residualSpaces = new List<ResidualSpace>(); … … 17 17 var rs3 = CalculateYXZ(binPacking, point); 18 18 19 residualSpaces.Add(rs1); 20 21 22 if (!residualSpaces.Any(rs => rs.Equals(rs2))) { 19 if (!rs1.IsZero()) { 20 residualSpaces.Add(rs1); 21 } 22 23 24 if (!rs2.IsZero() && !residualSpaces.Any(rs => rs.Equals(rs2))) { 23 25 residualSpaces.Add(rs2); 24 26 } 25 if (!r esidualSpaces.Any(rs => rs.Equals(rs3))) {27 if (!rs3.IsZero() && !residualSpaces.Any(rs => rs.Equals(rs3))) { 26 28 residualSpaces.Add(rs3); 27 29 } … … 56 58 } 57 59 60 /// <summary> 61 /// Returnst true if a given residual space and item overlaps at the x-axis 62 /// </summary> 63 /// <param name="point"></param> 64 /// <param name="residualSpace"></param> 65 /// <param name="position"></param> 66 /// <param name="item"></param> 67 /// <returns></returns> 58 68 private bool OverlapsX(Vector3D point, ResidualSpace residualSpace, PackingPosition position, PackingItem item) { 59 69 if (point.X > position.X && point.X >= position.X + item.Width) { … … 66 76 return true; 67 77 } 68 78 79 /// <summary> 80 /// Returnst true if a given residual space and item overlaps at the y-axis 81 /// </summary> 82 /// <param name="point"></param> 83 /// <param name="residualSpace"></param> 84 /// <param name="position"></param> 85 /// <param name="item"></param> 69 86 private bool OverlapsY(Vector3D point, ResidualSpace residualSpace, PackingPosition position, PackingItem item) { 70 87 if (point.Y > position.Y && point.Y >= position.Y + item.Height) { … … 78 95 } 79 96 97 /// <summary> 98 /// Returnst true if a given residual space and item overlaps at the z-axis 99 /// </summary> 100 /// <param name="point"></param> 101 /// <param name="residualSpace"></param> 102 /// <param name="position"></param> 103 /// <param name="item"></param> 80 104 private bool OverlapsZ(Vector3D point, ResidualSpace residualSpace, PackingPosition position, PackingItem item) { 81 105 if (point.Z > position.Z && point.Z >= position.Z + item.Depth) { … … 90 114 91 115 private bool OverlapsOnRight(Vector3D point, ResidualSpace residualSpace, PackingPosition position, PackingItem item) { 116 // if point.x >= position.x, the residual space would be located on the left side! 92 117 if (point.X >= position.X) { 93 118 return false;
Note: See TracChangeset
for help on using the changeset viewer.