示例#1
0
        public static bool TryParse(string input, out Vector4Int ret)
        {
            var m = vec_reg.Match(input);

            ret = new Vector4Int();
            if (m.Success)
            {
                if (int.TryParse(m.Groups["X"].Value, out ret.x))
                {
                    if (int.TryParse(m.Groups["Y"].Value, out ret.y))
                    {
                        if (int.TryParse(m.Groups["Z"].Value, out ret.z))
                        {
                            return(int.TryParse(m.Groups["W"].Value, out ret.w));
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public static Vector4Int Parse(string input)
        {
            var m = vec_reg.Match(input);

            if (m.Success)
            {
                var val = new Vector4Int();
                val.x = int.Parse(m.Groups["X"].Value);
                val.y = int.Parse(m.Groups["Y"].Value);
                val.z = int.Parse(m.Groups["Z"].Value);
                val.w = int.Parse(m.Groups["W"].Value);
                return(val);
            }
            else
            {
                throw new FormatException("Input string was not in correct format");
            }
        }
示例#3
0
文件: VectorInt.cs 项目: r-bel/glorg2
 public static bool TryParse(string input, out Vector4Int ret)
 {
     var m = vec_reg.Match(input);
     ret = new Vector4Int();
     if (m.Success)
     {
         if (int.TryParse(m.Groups["X"].Value, out ret.x))
             if (int.TryParse(m.Groups["Y"].Value, out ret.y))
                 if (int.TryParse(m.Groups["Z"].Value, out ret.z))
                     return int.TryParse(m.Groups["W"].Value, out ret.w);
                 else return false;
             else return false;
         else
             return false;
     }
     else
         return false;
 }
示例#4
0
文件: VectorInt.cs 项目: r-bel/glorg2
 public static Vector4Int Parse(string input)
 {
     var m = vec_reg.Match(input);
     if (m.Success)
     {
         var val = new Vector4Int();
         val.x = int.Parse(m.Groups["X"].Value);
         val.y = int.Parse(m.Groups["Y"].Value);
         val.z = int.Parse(m.Groups["Z"].Value);
         val.w = int.Parse(m.Groups["W"].Value);
         return val;
     }
     else
         throw new FormatException("Input string was not in correct format");
 }
示例#5
0
文件: VectorInt.cs 项目: r-bel/glorg2
 public static int Dot(Vector4Int a, Vector4Int b)
 {
     return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
 }
示例#6
0
 public static int Dot(Vector4Int a, Vector4Int b)
 {
     return(a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w);
 }