Example #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);
            }
        }
Example #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");
            }
        }
Example #3
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;
 }
Example #4
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");
 }
Example #5
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;
 }
Example #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);
 }