예제 #1
0
 private void FocusTineSpacing(StabResult stabResult, Trident trident)
 {
     if (stabResult.LeftDistance < stabResult.RightDistance)
     {
         tineSpacing = (trident.MiddleVariable - trident.LeftVariable) / 2;
     }
     else
     {
         tineSpacing = (trident.RightVariable - trident.MiddleVariable) / 2;
     }
 }
예제 #2
0
 private void ApplyNearRightFocus(StabResult stabResult, Trident trident, decimal tineOutFactor)
 {
     onVariable = trident.RightVariable;
     if (!lockTineExplore)
     {
         tineSpacing = tineSpacing + (tineSpacing * tineOutFactor);
     }
     else
     {
         FocusTineSpacing(stabResult, trident);
     }
 }
예제 #3
0
        private StabResult GetStabResult(Trident trident, decimal acceptDistance, decimal breakOutDistance, decimal goal)
        {
            var middleDistance = trident.MiddleValue.HasValue ? Math.Abs(goal - trident.MiddleValue.Value) : (decimal?)null;

            if (middleDistance <= acceptDistance)
            {
                return(new StabResult(0, middleDistance, 0, StabResultEnum.Stab));
            }
            if (Math.Abs(trident.RightVariable - trident.LeftVariable) <= breakOutDistance)
            {
                return(new StabResult(0, middleDistance, 0, StabResultEnum.Stab));
            }
            var leftDistance  = trident.LeftValue.HasValue ? Math.Abs(goal - trident.LeftValue.Value) : (decimal?)null;
            var rightDistance = trident.RightValue.HasValue ? Math.Abs(goal - trident.RightValue.Value) : (decimal?)null;

            if (!leftDistance.HasValue && !rightDistance.HasValue && !middleDistance.HasValue)
            {
                return(new StabResult(null, null, null, StabResultEnum.Null));
            }
            if (middleDistance.HasValue)
            {
                if (!leftDistance.HasValue && rightDistance.HasValue)
                {
                    return(middleDistance.Value < rightDistance.Value ? new StabResult(null, middleDistance, rightDistance, StabResultEnum.NearMiddle) : new StabResult(null, middleDistance, rightDistance, StabResultEnum.NearRight));
                }
                if (!rightDistance.HasValue && leftDistance.HasValue)
                {
                    return(middleDistance.Value < leftDistance.Value ? new StabResult(leftDistance, middleDistance, null, StabResultEnum.NearMiddle) : new StabResult(leftDistance, middleDistance, null, StabResultEnum.NearLeft));
                }
            }
            else
            {
                if (!leftDistance.HasValue)
                {
                    return(new StabResult(null, null, rightDistance, StabResultEnum.NearRight));
                }
                if (!rightDistance.HasValue)
                {
                    return(new StabResult(leftDistance, null, null, StabResultEnum.NearLeft));
                }
                return(leftDistance.Value < rightDistance.Value ? new StabResult(leftDistance, null, rightDistance, StabResultEnum.NearLeft) :
                       new StabResult(leftDistance, null, rightDistance, StabResultEnum.NearRight));
            }
            if (middleDistance < leftDistance && middleDistance < rightDistance)
            {
                return(new StabResult(leftDistance, middleDistance, rightDistance, StabResultEnum.NearMiddle));
            }
            if (leftDistance < rightDistance)
            {
                return(new StabResult(leftDistance, middleDistance, rightDistance, StabResultEnum.NearLeft));
            }
            return(new StabResult(leftDistance, middleDistance, rightDistance, StabResultEnum.NearRight));
        }