private void Initialize() { // Distance from start to center. const float twoPi = 2 * 3.141592654f; float oox = Origin.X - Center.X; float ooy = Origin.Y - Center.Y; float eex = End.X - Center.X; float eey = End.Y - Center.Y; Distance = (float)Math2.Sqrt(oox * oox + ooy * ooy); // Alpha angle: start with X axis Alpha = (float)Math2.Atan2(ooy, oox); // Beta angle: end with X axis Beta = (float)Math2.Atan2(eey, eex); // Gamma angle is arc angle (beta - alpha) if (Alpha < 0 && Beta > 0) { Gamma = Beta - (Alpha + twoPi); } else if (Alpha > 0 && Beta < 0) { Gamma = (Beta + twoPi) - Alpha; } else { Gamma = Beta - Alpha; } if (Math2.Abs(Gamma) > 3.141592654f) { Gamma = Beta - Alpha; } }
internal static double ParseDouble() { string val = ReadNumber(); if (val == null) { Logger.Error("ParseDouble: no numbers at {0} in '{1}'. Skipped.", CurrentIndex, Line); return(double.MinValue); } try { return(Math2.StringToDouble(val)); } catch (Exception ex) { Logger.Error("ParseDouble ERROR parsing '{0}': {1}", val, ex); return(double.MinValue); } }