Ignore:
Timestamp:
08/04/17 23:45:08 (4 years ago)
Author:
abeham
Message:

#2817:

  • Added checkbox to control showing extreme points in visualization
    • Automatically determine size of extreme point cubes
  • Fixed some bugs in extreme point generation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking.Views/3.3/Container3DView.xaml.cs

    r15306 r15307  
    5555    private double startAngleY;
    5656    private int selectedItemKey;
     57    private bool showExtremePoints;
    5758
    5859    private BinPacking<BinPacking3D.PackingPosition, PackingShape, PackingItem> packing;
     
    155156      }
    156157
    157       // draw extreme-points
    158       foreach (var ep in packing.ExtremePoints) {
    159         var epModel = new GeometryModel3D { Geometry = new MeshGeometry3D(), Material = new DiffuseMaterial() { Brush = new SolidColorBrush(Colors.Red) } };
    160         AddSolidCube((MeshGeometry3D)epModel.Geometry, ep.X, ep.Y, ep.Z, 10, 10, 10);
    161         modelGroup.Children.Add(epModel);
     158      if (showExtremePoints) {
     159        // draw extreme-points
     160        var maxMag = (int)Math.Log10(Math.Max(packing.BinShape.Depth, Math.Max(packing.BinShape.Height, packing.BinShape.Width)));
     161        var cubeSize = (int)Math.Max(Math.Pow(10, maxMag - 2), 1);
     162        foreach (var ep in packing.ExtremePoints) {
     163          var epModel = new GeometryModel3D { Geometry = new MeshGeometry3D(), Material = new DiffuseMaterial() { Brush = new SolidColorBrush(Colors.Red) } };
     164          AddSolidCube((MeshGeometry3D)epModel.Geometry, ep.X, ep.Y, ep.Z, cubeSize, cubeSize, cubeSize);
     165          modelGroup.Children.Add(epModel);
     166        }
    162167      }
    163168
     
    229234    private void Container3DView_OnMouseEnter(object sender, MouseEventArgs e) {
    230235      Focus(); // for mouse wheel events
     236    }
     237    private void showExtremePointsCheckBoxOnChecked(object sender, RoutedEventArgs e) {
     238      showExtremePoints = true;
     239      UpdateVisualization();
     240    }
     241    private void showExtremePointsCheckBoxOnUnchecked(object sender, RoutedEventArgs e) {
     242      showExtremePoints = false;
     243      UpdateVisualization();
    231244    }
    232245
     
    471484    }
    472485    #endregion
    473 
    474486  }
    475487}
Note: See TracChangeset for help on using the changeset viewer.