Example #1
0
 public void Clamp(Vec3i min, Vec3i max)
 {
     if (Rg < min.Rg)
     {
         Rg = min.Rg;
     }
     else if (Rg > max.Rg)
     {
         Rg = max.Rg;
     }
     if (RH < min.RH)
     {
         RH = min.RH;
     }
     else if (RH > max.RH)
     {
         RH = max.RH;
     }
     if (Rh < min.Rh)
     {
         Rh = min.Rh;
     }
     else if (Rh > max.Rh)
     {
         Rh = max.Rh;
     }
 }
Example #2
0
 public Vec4i(Vec3i v, int w)
 {
     RM = v.X;
     Rm = v.Y;
     RN = v.Z;
     Rn = w;
 }
Example #3
0
        public static Vec3i Subtract(Vec3i v1, Vec3i v2)
        {
            Vec3i veci;

            veci.Rg = v1.Rg - v2.Rg;
            veci.RH = v1.RH - v2.RH;
            veci.Rh = v1.Rh - v2.Rh;
            return(veci);
        }
Example #4
0
        public static Vec3i Divide(Vec3i v1, Vec3i v2)
        {
            Vec3i veci;

            veci.Rg = v1.Rg / v2.Rg;
            veci.RH = v1.RH / v2.RH;
            veci.Rh = v1.Rh / v2.Rh;
            return(veci);
        }
Example #5
0
        public static Vec3i Multiply(Vec3i v1, Vec3i v2)
        {
            Vec3i veci;

            veci.Rg = v1.Rg * v2.Rg;
            veci.RH = v1.RH * v2.RH;
            veci.Rh = v1.Rh * v2.Rh;
            return(veci);
        }
Example #6
0
        public static Vec3i Divide(Vec3i v, int i)
        {
            Vec3i veci;

            veci.Rg = v.Rg / i;
            veci.RH = v.RH / i;
            veci.Rh = v.Rh / i;
            return(veci);
        }
Example #7
0
        public static Vec3i Divide(int i, Vec3i v)
        {
            Vec3i veci;

            veci.Rg = i / v.Rg;
            veci.RH = i / v.RH;
            veci.Rh = i / v.Rh;
            return(veci);
        }
Example #8
0
        public static Vec3i Negate(Vec3i v)
        {
            Vec3i veci;

            veci.Rg = -v.Rg;
            veci.RH = -v.RH;
            veci.Rh = -v.Rh;
            return(veci);
        }
Example #9
0
        public static Vec3i Add(Vec3i v1, Vec3i v2)
        {
            Vec3i veci;

            veci.Rg = v1.Rg + v2.Rg;
            veci.RH = v1.RH + v2.RH;
            veci.Rh = v1.Rh + v2.Rh;
            return(veci);
        }
Example #10
0
        public static Vec3i Multiply(int i, Vec3i v)
        {
            Vec3i veci;

            veci.Rg = v.Rg * i;
            veci.RH = v.RH * i;
            veci.Rh = v.Rh * i;
            return(veci);
        }
Example #11
0
        public static Vec3i Parse(string text)
        {
            Vec3i veci;

            if (string.IsNullOrEmpty(text))
            {
                throw new ArgumentNullException("The text parameter cannot be null or zero length.");
            }
            string[] strArray = text.Split(SpaceCharacter.arrayWithOneSpaceCharacter, StringSplitOptions.RemoveEmptyEntries);
            if (strArray.Length != 3)
            {
                throw new FormatException(string.Format("Cannot parse the text '{0}' because it does not have 3 parts separated by spaces in the form (x y z).", text));
            }
            try
            {
                veci = new Vec3i(int.Parse(strArray[0]), int.Parse(strArray[1]), int.Parse(strArray[2]));
            }
            catch (Exception)
            {
                throw new FormatException("The parts of the vectors must be decimal numbers.");
            }
            return(veci);
        }
Example #12
0
 public static void Subtract(ref Vec3i v1, ref Vec3i v2, out Vec3i result)
 {
     result.Rg = v1.Rg - v2.Rg;
     result.RH = v1.RH - v2.RH;
     result.Rh = v1.Rh - v2.Rh;
 }
Example #13
0
 public static void Cross(ref Vec3i v1, ref Vec3i v2, out Vec3i result)
 {
     result.Rg = (v1.RH * v2.Rh) - (v1.Rh * v2.RH);
     result.RH = (v1.Rh * v2.Rg) - (v1.Rg * v2.Rh);
     result.Rh = (v1.Rg * v2.RH) - (v1.RH * v2.Rg);
 }
Example #14
0
 public static void Add(ref Vec3i v1, ref Vec3i v2, out Vec3i result)
 {
     result.Rg = v1.Rg + v2.Rg;
     result.RH = v1.RH + v2.RH;
     result.Rh = v1.Rh + v2.Rh;
 }
Example #15
0
 public static void Dot(ref Vec3i v1, ref Vec3i v2, out int result)
 {
     result = ((v1.Rg * v2.Rg) + (v1.RH * v2.RH)) + (v1.Rh * v2.Rh);
 }
Example #16
0
 public static Vec3i Cross(Vec3i v1, Vec3i v2)
 {
     return(new Vec3i((v1.RH * v2.Rh) - (v1.Rh * v2.RH), (v1.Rh * v2.Rg) - (v1.Rg * v2.Rh), (v1.Rg * v2.RH) - (v1.RH * v2.Rg)));
 }
Example #17
0
 public static void Multiply(int i, ref Vec3i v, out Vec3i result)
 {
     result.Rg = v.Rg * i;
     result.RH = v.RH * i;
     result.Rh = v.Rh * i;
 }
Example #18
0
 public static int Dot(Vec3i v1, Vec3i v2)
 {
     return(((v1.Rg * v2.Rg) + (v1.RH * v2.RH)) + (v1.Rh * v2.Rh));
 }
Example #19
0
 public static void Divide(ref Vec3i v, int i, out Vec3i result)
 {
     result.Rg = v.Rg / i;
     result.RH = v.RH / i;
     result.Rh = v.Rh / i;
 }
Example #20
0
 public static void Divide(ref Vec3i v1, ref Vec3i v2, out Vec3i result)
 {
     result.Rg = v1.Rg / v2.Rg;
     result.RH = v1.RH / v2.RH;
     result.Rh = v1.Rh / v2.Rh;
 }
Example #21
0
 public static void Divide(int i, ref Vec3i v, out Vec3i result)
 {
     result.Rg = i / v.Rg;
     result.RH = i / v.RH;
     result.Rh = i / v.Rh;
 }
Example #22
0
 public static void Multiply(ref Vec3i v1, ref Vec3i v2, out Vec3i result)
 {
     result.Rg = v1.Rg * v2.Rg;
     result.RH = v1.RH * v2.RH;
     result.Rh = v1.Rh * v2.Rh;
 }
Example #23
0
 public static void Negate(ref Vec3i v, out Vec3i result)
 {
     result.Rg = -v.Rg;
     result.RH = -v.RH;
     result.Rh = -v.Rh;
 }
Example #24
0
 public Vec3i(Vec3i source)
 {
     Rg = source.Rg;
     RH = source.RH;
     Rh = source.Rh;
 }
Example #25
0
 static Vec3i()
 {
     Zero = new Vec3i(0, 0, 0);
 }