Changeset 9599 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Shapes/RectangularPackingShape.cs
- Timestamp:
- 06/09/13 12:58:39 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Shapes/RectangularPackingShape.cs
r9596 r9599 52 52 53 53 public override bool EnclosesPoint(TwoDimensionalPacking myPosition, TwoDimensionalPacking checkedPoint) { 54 var r = new RectangleDiagonal(myPosition, this); 55 return (r.x1 <= checkedPoint.X && 56 r.x2 >= checkedPoint.X && 57 r.y1 <= checkedPoint.Y && 58 r.y2 >= checkedPoint.Y); 54 return (myPosition.X <= checkedPoint.X && 55 (myPosition.X + (myPosition.Rotated ? Height : Width) - 1) >= checkedPoint.X && 56 myPosition.Y <= checkedPoint.Y && 57 (myPosition.Y + (myPosition.Rotated ? Width : Height) - 1) >= checkedPoint.Y); 59 58 } 60 59 public override bool Encloses(TwoDimensionalPacking checkedPosition, PackingShape<TwoDimensionalPacking> checkedShape) { … … 78 77 } 79 78 private bool Overlaps(RectangleDiagonal r1, RectangleDiagonal r2) { 80 return !(r1.x1 > =r2.x2 ||81 r1.y1 > =r2.y2 ||82 r1.x2 < =r2.x1 ||83 r1.y2 < =r2.y1);79 return !(r1.x1 > r2.x2 || 80 r1.y1 > r2.y2 || 81 r1.x2 < r2.x1 || 82 r1.y2 < r2.y1); 84 83 } 85 84 … … 150 149 x1 = myPosition.X; 151 150 y1 = myPosition.Y; 152 x2 = myPosition.X + (myPosition.Rotated ? myShape.Height : myShape.Width) ;153 y2 = myPosition.Y + (myPosition.Rotated ? myShape.Width : myShape.Height) ;151 x2 = myPosition.X + (myPosition.Rotated ? myShape.Height : myShape.Width) - 1; 152 y2 = myPosition.Y + (myPosition.Rotated ? myShape.Width : myShape.Height) - 1; 154 153 } 155 154 }
Note: See TracChangeset
for help on using the changeset viewer.