public static int Distance(Vector6Int a, Vector6Int b) { return((int)Math.Sqrt(((b.largeRow - a.largeRow) * (b.largeRow - a.largeRow)) + ((b.largeColumn - a.largeColumn) * (b.largeColumn - a.largeColumn)) + ((b.smallRow - a.smallRow) * (b.smallRow - a.smallRow)) + ((b.smallColumn - a.smallColumn) * (b.smallColumn - a.smallColumn)) + ((b.wonBy - a.wonBy) * (b.wonBy - a.wonBy)))); }
public static int Magnitude(Vector6Int a) { return((int)Mathf.Sqrt( Mathf.Pow(a.largeRow, 2) + Mathf.Pow(a.largeColumn, 2) + Mathf.Pow(a.smallRow, 2) + Mathf.Pow(a.smallColumn, 2) + Mathf.Pow(a.wonBy, 2) + Mathf.Pow(a.valid, 2))); }
public static Vector6Int Normalize(Vector6Int a) { int Mag = Vector6Int.Magnitude(a); return(new Vector6Int( a.largeRow / Mag, a.largeColumn / Mag, a.smallRow / Mag, a.smallColumn / Mag, a.wonBy / Mag, a.valid / Mag)); }
public override bool Equals(object obj) { if (obj is Vector6Int) { Vector6Int A = (Vector6Int)obj; if (A.largeRow != this.largeRow) { return(false); } else if (A.largeColumn != this.largeColumn) { return(false); } else if (A.smallRow != this.smallRow) { return(false); } else if (A.smallColumn != this.smallColumn) { return(false); } else if (A.wonBy != this.wonBy) { return(false); } else if (A.valid != this.valid) { return(false); } else { return(true); } } else { throw new InvalidCastException("The object 'obj' is not castable to the type 'Vector6'"); } }
public static int Angle(Vector6Int a, Vector6Int b) { Vector6Int A = a; Vector6Int B = b; A.largeRow = A.largeRow % 360; A.largeColumn = A.largeColumn % 360; A.smallRow = A.smallRow % 360; A.smallColumn = A.smallColumn % 360; A.wonBy = A.wonBy % 360; A.valid = A.valid % 360; B.largeRow = B.largeRow % 360; B.largeColumn = B.largeColumn % 360; B.smallRow = B.smallRow % 360; B.smallColumn = B.smallColumn % 360; B.wonBy = B.wonBy % 360; B.valid = B.valid % 360; if (A.largeRow > 180) { A.largeRow = -(360 - A.largeRow); } if (A.largeColumn > 180) { A.largeColumn = -(360 - A.largeColumn); } if (A.smallRow > 180) { A.smallRow = -(360 - A.smallRow); } if (A.smallColumn > 180) { A.smallColumn = -(360 - A.smallColumn); } if (A.wonBy > 180) { A.wonBy = -(360 - A.wonBy); } if (A.valid > 180) { A.valid = -(360 - A.valid); } if (B.largeRow > 180) { B.largeRow = -(360 - B.largeRow); } if (B.largeColumn > 180) { B.largeColumn = -(360 - B.largeColumn); } if (B.smallRow > 180) { B.smallRow = -(360 - B.smallRow); } if (B.smallColumn > 180) { B.smallColumn = -(360 - B.smallColumn); } if (B.wonBy > 180) { B.wonBy = -(360 - B.wonBy); } if (B.valid > 180) { B.valid = -(360 - B.valid); } return((int)Mathf.Sqrt(((B.largeRow - A.largeRow) * (B.largeRow - A.largeRow)) + ((B.largeColumn - A.largeColumn) * (B.largeColumn - A.largeColumn)) + ((B.smallRow - A.smallRow) * (B.smallRow - A.smallRow)) + ((B.smallColumn - A.smallColumn) * (B.smallColumn - A.smallColumn)) + ((B.wonBy - A.wonBy) * (B.wonBy - A.wonBy) * (A.valid - B.valid)))); }
public static int Dot(Vector6Int a, Vector6Int b) { return((a.largeRow * b.largeRow) + (a.largeColumn * b.largeColumn) + (a.smallRow * b.smallRow) + (a.smallColumn * b.smallColumn) + (a.wonBy * b.wonBy) + (a.valid * b.valid)); }
public static int SqrMagnitude(Vector6Int a) { return((int)Mathf.Pow(Vector6Int.Magnitude(a), 2)); }