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; } }
public Vec4i(Vec3i v, int w) { RM = v.X; Rm = v.Y; RN = v.Z; Rn = w; }
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); }
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); }
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); }
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); }
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); }
public static Vec3i Negate(Vec3i v) { Vec3i veci; veci.Rg = -v.Rg; veci.RH = -v.RH; veci.Rh = -v.Rh; return(veci); }
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); }
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); }
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); }
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; }
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); }
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; }
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); }
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))); }
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; }
public static int Dot(Vec3i v1, Vec3i v2) { return(((v1.Rg * v2.Rg) + (v1.RH * v2.RH)) + (v1.Rh * v2.Rh)); }
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; }
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; }
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; }
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; }
public static void Negate(ref Vec3i v, out Vec3i result) { result.Rg = -v.Rg; result.RH = -v.RH; result.Rh = -v.Rh; }
public Vec3i(Vec3i source) { Rg = source.Rg; RH = source.RH; Rh = source.Rh; }
static Vec3i() { Zero = new Vec3i(0, 0, 0); }