コード例 #1
0
        /// <summary>Returns the translation transform of @this for the upper-left corner of the specified hex.</summary>
        /// <typeparam name="THex"></typeparam>
        /// <param name="this"></param>
        /// <param name="coords">Type: HexCoords - Coordinates of the hex to be painted next.</param>
        public static Matrix TranslateToHex <THex>(this IMapDisplayWinForms <THex> @this, HexCoords coords)
            where THex : IHex
        {
            var offset = @this.UpperLeftOfHex <THex>(coords);

            return(new Matrix(1, 0, 0, 1, offset.X, offset.Y));
        }
コード例 #2
0
 /// <summary>Returns pixel coordinates of centre of specified hex.</summary>
 /// <param name="this"></param>
 /// <param name="coords"></param>
 /// <returns>A Point structure containing pixel coordinates for the (centre of the) specified hex.</returns>
 public static HexPoint CentreOfHex <THex>(this IMapDisplayWinForms <THex> @this, HexCoords coords)
     where THex : IHex
 => @this.UpperLeftOfHex(coords) + @this.HexCentreOffset;