From 93c13de1ef054074f89e3f7dcbb8984f256c0a1d Mon Sep 17 00:00:00 2001 From: Marius Merschformann Date: Sun, 10 Nov 2024 23:47:49 +0100 Subject: [PATCH] Improve orientation readability --- SC.Linear/LinearModelFLB.cs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/SC.Linear/LinearModelFLB.cs b/SC.Linear/LinearModelFLB.cs index f3db8be..d03e05e 100644 --- a/SC.Linear/LinearModelFLB.cs +++ b/SC.Linear/LinearModelFLB.cs @@ -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; @@ -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 }); }