Skip to content

Commit

Permalink
Improve orientation readability
Browse files Browse the repository at this point in the history
  • Loading branch information
merschformann committed Nov 10, 2024
1 parent f5ee669 commit 93c13de
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions SC.Linear/LinearModelFLB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ internal override void TransformIntermediateSolution()
if (container == null) continue;

// Get orientation
var orientation = 0;
int orientation;
if (_rotation[piece, 1, 1].CallbackValue > 0.5)
{
orientation = _rotation[piece, 2, 2].CallbackValue > 0.5 ? 0 : 4;
Expand Down Expand Up @@ -659,23 +659,20 @@ internal override void TransformSolution()
if (container != null)
{
// Get orientation
int orientation = 0;
int orientation;
if (_rotation[piece, 1, 1].Value > 0.5)
if (_rotation[piece, 2, 2].Value > 0.5)
orientation = 0;
else
orientation = 4;
else
if (_rotation[piece, 1, 2].Value > 0.5)
if (_rotation[piece, 2, 1].Value > 0.5)
orientation = 1;
else
orientation = 17;
else
if (_rotation[piece, 2, 1].Value > 0.5)
orientation = 5;
{
orientation = _rotation[piece, 2, 2].Value > 0.5 ? 0 : 4;
}
else if (_rotation[piece, 1, 2].Value > 0.5)
{
orientation = _rotation[piece, 2, 1].Value > 0.5 ? 1 : 17;
}
else
orientation = 16;
{
orientation = _rotation[piece, 2, 1].Value > 0.5 ? 5 : 16;
}

// Add to solution
Solution.Add(container, piece, orientation, new MeshPoint() { X = _frontLeftBottomX[piece].Value, Y = _frontLeftBottomY[piece].Value, Z = _frontLeftBottomZ[piece].Value });
}
Expand Down

0 comments on commit 93c13de

Please sign in to comment.