Ejemplo n.º 1
0
        public static Frame3D Parse(string line)
        {
            var ar = line.Replace("X = ", "")
                     .Replace("Y = ", "")
                     .Replace(" Z = ", "")
                     .Replace(" Pitch = ", "")
                     .Replace(" Yaw = ", "")
                     .Replace(" Roll = ", "")
                     .Replace(" ", "")
                     .Split(',');

            //var match = new Regex(@"\s?[A-Za-z]* = (\d+[.,]?\d*)").Match(line);
            //return new Frame3D(
            //    double.Parse(match.Groups[0].Value, CultureInfo.InvariantCulture),
            //    double.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture),
            //    double.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture),
            //    Angle.FromGrad(double.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture)),
            //    Angle.FromGrad(double.Parse(match.Groups[4].Value, CultureInfo.InvariantCulture)),
            //    Angle.FromGrad(double.Parse(match.Groups[5].Value, CultureInfo.InvariantCulture)));

            return(new Frame3D(
                       double.Parse(ar[0], CultureInfo.InvariantCulture),
                       double.Parse(ar[1], CultureInfo.InvariantCulture),
                       double.Parse(ar[2], CultureInfo.InvariantCulture),
                       Angle.FromGrad(double.Parse(ar[3], CultureInfo.InvariantCulture)),
                       Angle.FromGrad(double.Parse(ar[4], CultureInfo.InvariantCulture)),
                       Angle.FromGrad(double.Parse(ar[5], CultureInfo.InvariantCulture))));
        }
Ejemplo n.º 2
0
        public Frame2D Diff(Frame2D previos)
        {
            var x     = previos.X - X;
            var y     = previos.Y - Y;
            var angle = Angle.FromGrad(previos.Angle.Radian - Angle.Radian);

            return(new Frame2D(x, y, angle));
        }
Ejemplo n.º 3
0
            public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
            {
                if (dictionary == null)
                {
                    throw new ArgumentNullException("dictionary");
                }
                var angle = Angle.FromGrad(Convert.ToDouble(dictionary["Grad"]));

                return(angle);
            }