Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/20/17 16:15:38 (6 years ago)
Author:
rhanghof
Message:

#2817:

  • Unittests
  • Bugfixes on the line projection based extreme point creation method
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ResidualSpaceCalculation/ResidualSpaceCalculator.cs

    r15520 r15554  
    1010
    1111    internal ResidualSpaceCalculator() {}
    12 
     12   
    1313    public IEnumerable<ResidualSpace> CalculateResidualSpaces(BinPacking3D binPacking, Vector3D point) {
    1414      IList<ResidualSpace> residualSpaces = new List<ResidualSpace>();
     
    1717      var rs3 = CalculateYXZ(binPacking, point);
    1818
    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))) {
    2325        residualSpaces.Add(rs2);
    2426      }
    25       if (!residualSpaces.Any(rs => rs.Equals(rs3))) {
     27      if (!rs3.IsZero() && !residualSpaces.Any(rs => rs.Equals(rs3))) {
    2628        residualSpaces.Add(rs3);
    2729      }
     
    5658    }
    5759   
     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>
    5868    private bool OverlapsX(Vector3D point, ResidualSpace residualSpace, PackingPosition position, PackingItem item) {
    5969      if (point.X > position.X && point.X >= position.X + item.Width) {
     
    6676      return true;
    6777    }
    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>
    6986    private bool OverlapsY(Vector3D point, ResidualSpace residualSpace, PackingPosition position, PackingItem item) {
    7087      if (point.Y > position.Y && point.Y >= position.Y + item.Height) {
     
    7895    }
    7996
     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>
    80104    private bool OverlapsZ(Vector3D point, ResidualSpace residualSpace, PackingPosition position, PackingItem item) {
    81105      if (point.Z > position.Z && point.Z >= position.Z + item.Depth) {
     
    90114
    91115    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!
    92117      if (point.X >= position.X) {
    93118        return false;
Note: See TracChangeset for help on using the changeset viewer.