private HexCoords(bool isCanon, IntVector2D vector) : this()
 {
     if (isCanon)
     {
         Canon = vector; userHasValue = false;
     }
     else
     {
         User = vector; canonHasValue = false;
     }
 }
 /// <summary>Create a new instance located at the specified vector offset as interpreted in the Rectangular (User) frame.</summary>
 public static HexCoords NewUserCoords(IntVector2D vector)
 {
     return(new HexCoords(false, vector));
 }
 /// <summary>Create a new instance located at the specified vector offset as interpreted in the Canon(ical) frame.</summary>
 public static HexCoords NewCanonCoords(IntVector2D vector)
 {
     return(new HexCoords(true, vector));
 }
 /// <summary>Create a new instance located at the specified vector offset as interpreted in the Canon(ical) frame.</summary>
 public static HexCoords NewCanonCoords(IntVector2D vector)
 => new HexCoords(vector, vector * _matrixCanonToUser);
 /// <summary>Return the coordinate vector of this hex in the User frame.</summary>
 public HexCoords CustomToUser(IntVector2D coords)
 => HexCoords.NewUserCoords(coords * MatrixUserToCustom);
 /// <summary>Create a new instance located at the specified vector offset as interpreted in the Rectangular (User) frame.</summary>
 public static HexCoords NewUserCoords(IntVector2D vector)
 => new HexCoords(vector * _matrixUserToCanon, vector);
 private HexCoords(IntVector2D canon, IntVector2D user) : this()
 {
     Canon = canon;
     User  = user;
 }
Exemple #8
0
 /// <summary>(Contravariant) Vector transformation by a matrix.</summary>
 public static IntVector2D Multiply(IntVector2D v, IntMatrix2D m) => v * m;
Exemple #9
0
 /// <summary> Initializes a new <code>IntMatrix2D</code> as the translation defined by the vector vector.</summary>
 /// <param name="vector">the translation vector</param>
 public IntMatrix2D(IntVector2D vector)  : this(1, 0, 0, 1, vector.X, vector.Y, 1)
 {
 }
 /// <summary>Return the coordinate vector of this hex in the User frame.</summary>
 public static HexCoords CustomToUser(this IntVector2D @this)
 {
     return(HexCoords.NewUserCoords(@this * MatrixUserToCustom));
 }
 /// <summary>Returns whether the specified hex coordinates are "on" a board of the given dimensions.</summary>
 /// <param name="mapSizeHexes">The hex dimensions of the board.</param>
 /// <param name="userCoords">The User coordinates of the hex of interest.</param>
 public static bool IsOnboard(this HexSize mapSizeHexes, IntVector2D userCoords) =>
 mapSizeHexes.IsOnboard(userCoords.X, userCoords.Y);
Exemple #12
0
 /// <summary>Create a new instance located at the specified i and j offsets as interpreted in the ectangular (User) frame.</summary>
 public static HexCoords NewUserCoords(int x, int y)
 => NewUserCoords(IntVector2D.New(x, y));
Exemple #13
0
 /// <summary>Create a new instance located at the specified vector offset as interpreted in the Rectangular (User) frame.</summary>
 public static HexCoords NewUserCoords(IntVector2D vector)
 {
     return(new HexCoords(vector * MatrixUserToCanon, vector));
 }
Exemple #14
0
 /// <summary>Create a new instance located at the specified vector offset as interpreted in the Canon(ical) frame.</summary>
 public static HexCoords NewCanonCoords(IntVector2D vector)
 {
     return(new HexCoords(vector, vector * MatrixCanonToUser));
 }