Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/12/16 10:42:58 (8 years ago)
Author:
gkronber
Message:

#1966: fixed various problems: bugs in cloning, bugs in persistence, method names, various minor improvements of source code for readability.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/CuboidShapePreparations.cs

    r13496 r13497  
    2525  public class CuboidShapePreparations {
    2626
    27     #region Private Members 
     27    #region Private Members
    2828    //Define the shape in a way so that the position is in the center of the shape.
    2929    //Define the 8 defining points of the cube
    30     Vector3 topLeftFront;
    31     Vector3 bottomLeftFront;
    32     Vector3 topRightFront;
    33     Vector3 bottomRightFront;
    34     Vector3 topLeftBack;
    35     Vector3 topRightBack;
    36     Vector3 bottomLeftBack;
    37     Vector3 bottomRightBack;
     30    private readonly Vector3 topLeftFront;
     31    private readonly Vector3 bottomLeftFront;
     32    private readonly Vector3 topRightFront;
     33    private readonly Vector3 bottomRightFront;
     34    private readonly Vector3 topLeftBack;
     35    private readonly Vector3 topRightBack;
     36    private readonly Vector3 bottomLeftBack;
     37    private readonly Vector3 bottomRightBack;
    3838
    3939    //Define normal vectors of the 6 surfaces
    40     Vector3 frontNormal;
    41     Vector3 backNormal;
    42     Vector3 topNormal;
    43     Vector3 bottomNormal;
    44     Vector3 leftNormal;
    45     Vector3 rightNormal;
     40    private readonly Vector3 frontNormal;
     41    private readonly Vector3 backNormal;
     42    private readonly Vector3 topNormal;
     43    private readonly Vector3 bottomNormal;
     44    private readonly Vector3 leftNormal;
     45    private readonly Vector3 rightNormal;
    4646
    4747    //Define colors of the 6 surfaces
    48     Color frontColor = Color.Black;
    49     Color backColor = Color.Black;
    50     Color topColor = Color.Black;
    51     Color bottomColor = Color.Black;
    52     Color leftColor = Color.Black;
    53     Color rightColor = Color.Black;
     48    private readonly Color frontColor = Color.Black;
     49    private readonly Color backColor = Color.Black;
     50    private readonly Color topColor = Color.Black;
     51    private readonly Color bottomColor = Color.Black;
     52    private readonly Color leftColor = Color.Black;
     53    private readonly Color rightColor = Color.Black;
    5454
    5555    #endregion Private Members
    5656
    5757
    58     public CuboidShapePreparations(Vector3 shapeSize, Vector3 shapePosition) : this (shapeSize, shapePosition, Color.Black) { }
     58    public CuboidShapePreparations(Vector3 shapeSize, Vector3 shapePosition) : this(shapeSize, shapePosition, Color.Black) { }
    5959    public CuboidShapePreparations(Vector3 shapeSize, Vector3 shapePosition, Color color) {
    6060      var halfShapeSize = shapeSize / 2;
     
    8585      leftColor = color;
    8686      rightColor = color;
    87 
    88     }
    89 
    90     public VertexPositionColorNormal[] CreateVertexDefinitionsForTriangles () {
     87    }
     88
     89    public VertexPositionColorNormal[] CreateVertexDefinitionsForTriangles() {
    9190      //Definition of the actual triangles
    9291      VertexPositionColorNormal[] shapeVertices = new VertexPositionColorNormal[36];
     
    160159    public VertexPositionColorNormal[] CreateVertexDefinitionsForEdgeLines(Color color) {
    161160      //Definition of the actual lines
    162       VertexPositionColorNormal[] shapeVertices = new VertexPositionColorNormal[48];
    163 
    164       Vector3 topRightFrontNormal = (topNormal + rightNormal + frontNormal) / 3;
    165       Vector3 topRightBackNormal = (topNormal + rightNormal + backNormal) / 3;
    166       Vector3 topLeftFrontNormal = (topNormal + leftNormal + frontNormal) / 3;
    167       Vector3 topLeftBackNormal = (topNormal + leftNormal + backNormal) / 3;
    168       Vector3 bottomRightFrontNormal = (topNormal + rightNormal + frontNormal) / 3;
    169       Vector3 bottomRightBackNormal = (topNormal + rightNormal + backNormal) / 3;
    170       Vector3 bottomLeftFrontNormal = (topNormal + leftNormal + frontNormal) / 3;
    171       Vector3 bottomLeftBackNormal = (topNormal + leftNormal + backNormal) / 3;
     161      var shapeVertices = new VertexPositionColorNormal[48];
     162
     163      var topRightFrontNormal = (topNormal + rightNormal + frontNormal) / 3;
     164      var topRightBackNormal = (topNormal + rightNormal + backNormal) / 3;
     165      var topLeftFrontNormal = (topNormal + leftNormal + frontNormal) / 3;
     166      var topLeftBackNormal = (topNormal + leftNormal + backNormal) / 3;
     167      var bottomRightFrontNormal = (topNormal + rightNormal + frontNormal) / 3;
     168      var bottomRightBackNormal = (topNormal + rightNormal + backNormal) / 3;
     169      var bottomLeftFrontNormal = (topNormal + leftNormal + frontNormal) / 3;
     170      var bottomLeftBackNormal = (topNormal + leftNormal + backNormal) / 3;
    172171
    173172      shapeVertices[0] = new VertexPositionColorNormal(color, topRightFront, topRightFrontNormal);
     
    227226      return shapeVertices;
    228227    }
    229 
    230 
    231228  }
    232229}
Note: See TracChangeset for help on using the changeset viewer.