Exemplo n.º 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;
     }
 }
Exemplo n.º 2
0
 public Vec4i(Vec3i v, int w)
 {
     RM = v.X;
     Rm = v.Y;
     RN = v.Z;
     Rn = w;
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 8
0
        public static Vec3i Negate(Vec3i v)
        {
            Vec3i veci;

            veci.Rg = -v.Rg;
            veci.RH = -v.RH;
            veci.Rh = -v.Rh;
            return(veci);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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)));
 }
Exemplo n.º 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;
 }
Exemplo n.º 18
0
 public static int Dot(Vec3i v1, Vec3i v2)
 {
     return(((v1.Rg * v2.Rg) + (v1.RH * v2.RH)) + (v1.Rh * v2.Rh));
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 23
0
 public static void Negate(ref Vec3i v, out Vec3i result)
 {
     result.Rg = -v.Rg;
     result.RH = -v.RH;
     result.Rh = -v.Rh;
 }
Exemplo n.º 24
0
 public Vec3i(Vec3i source)
 {
     Rg = source.Rg;
     RH = source.RH;
     Rh = source.Rh;
 }
Exemplo n.º 25
0
 static Vec3i()
 {
     Zero = new Vec3i(0, 0, 0);
 }