コード例 #1
0
        public HexOffsetCoordinates AxialToOffsetCoordinates(HexAxialCoordinates axial)
        {
            var cube = AxialToCube(axial);
            var offsetCoordinates = CubeToOffsetCoordinates(cube);

            return(offsetCoordinates);
        }
コード例 #2
0
        public override Point2F FromAxialToPixel(HexAxialCoordinates axial)
        {
            var x     = Size * (1.5f * axial.Q);
            var y     = (float)(Size * (Constants.HalfOfSquareRootOf3 * axial.Q + Constants.SquareRootOf3 * axial.R));
            var pixel = new Point2F(x, y);

            return(pixel);
        }
コード例 #3
0
        public HexAxialCoordinates CubeToAxial(HexCubeCoordinates cube)
        {
            var q     = cube.X;
            var r     = cube.Z;
            var axial = new HexAxialCoordinates(q, r);

            return(axial);
        }
コード例 #4
0
        public HexCubeCoordinates AxialToCube(HexAxialCoordinates axial)
        {
            var x    = axial.Q;
            var z    = axial.R;
            var y    = -x - z;
            var cube = new HexCubeCoordinates(x, y, z);

            return(cube);
        }
コード例 #5
0
 public Point2F FromAxialToPixel(HexAxialCoordinates axial) => _hex.FromAxialToPixel(axial);
コード例 #6
0
 public HexCubeCoordinates AxialToCube(HexAxialCoordinates axial) => _hex.AxialToCube(axial);
コード例 #7
0
 public HexOffsetCoordinates AxialToOffsetCoordinates(HexAxialCoordinates axial) => _hex.AxialToOffsetCoordinates(axial);
コード例 #8
0
 public abstract Point2F FromAxialToPixel(HexAxialCoordinates axial);