Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/01/17 12:33:51 (8 years ago)
Author:
abeham
Message:

#2739: fixed materials out of range index

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.BinPacking.Views/3.3/Container3DView.xaml.cs

    r14708 r14709  
    116116        else {
    117117          if (!materials.TryGetValue(item.Value.Material, out material)) {
    118             var color = colors[(item.Value.Material - 1) % colors.Length];
     118            var colorIdx = item.Value.Material;
     119            while (colorIdx < 0) colorIdx += colors.Length;
     120            colorIdx = colorIdx % colors.Length;
     121            var color = colors[colorIdx];
    119122            material = new DiffuseMaterial { Brush = new SolidColorBrush(color) };
    120123            materials[item.Value.Material] = material;
Note: See TracChangeset for help on using the changeset viewer.