// --- private --- void InitializeInputArrays(Doll doll, out double[] unknowns, out double[] lowerLimits, out double[] upperLimits) { var unknownList = new List <double>(); var lowerLimitList = new List <double>(); var upperLimitList = new List <double>(); // Field of view unknownList.Add(System.Math.PI / 4); // Initial assumption is 45 degree lowerLimitList.Add(30 * System.Math.PI / 180); upperLimitList.Add(50 * System.Math.PI / 180); // Center position for (int i = 0; i < 3; i++) { unknownList.Add(0.0); // Origin lowerLimitList.Add(double.MinValue); upperLimitList.Add(double.MaxValue); } // Angles foreach (var part in _targetParts) { // Heading-Pitch-Bank order for (int i = 0; i < 3; i++) { unknownList.Add(0.0); // No rotation } var limit = doll.GetEulerAngleLimit(part); lowerLimitList.Add(limit.Min.HeadingDeg); lowerLimitList.Add(limit.Min.PitchDeg); lowerLimitList.Add(limit.Min.BankDeg); upperLimitList.Add(limit.Max.HeadingDeg); upperLimitList.Add(limit.Max.PitchDeg); upperLimitList.Add(limit.Max.BankDeg); } unknowns = unknownList.ToArray(); lowerLimits = lowerLimitList.ToArray(); upperLimits = upperLimitList.ToArray(); }