Beispiel #1
0
    // Start is called before the first frame update
    void Start()
    {
        Layout flat = new Layout(Layout.flat, new Point(10.0, 10.0), new Point(0, 0));

        DoubledCoord d1 = new DoubledCoord(0, 0);
        DoubledCoord d2 = new DoubledCoord(1, 1);
        DoubledCoord d3 = new DoubledCoord(1, -1);
        Hex          h1 = d1.QdoubledToCube();
        Hex          h2 = d2.QdoubledToCube();
        Hex          h3 = d3.QdoubledToCube();

        Point points1 = flat.HexToPixel(h1);
        Point points2 = flat.HexToPixel(h2);
        Point points3 = flat.HexToPixel(h3);

        FractionalHex p  = flat.PixelToHex(new Point(0, 1));
        DoubledCoord  dp = DoubledCoord.QdoubledFromCube(p.HexRound());

        DoubledCoord d1n0 = DoubledCoord.QdoubledFromCube(h1.Neighbor(0));
        DoubledCoord d1n1 = DoubledCoord.QdoubledFromCube(h1.Neighbor(1));
        DoubledCoord d1n2 = DoubledCoord.QdoubledFromCube(h1.Neighbor(2));
        DoubledCoord d1n3 = DoubledCoord.QdoubledFromCube(h1.Neighbor(3));
        DoubledCoord d1n4 = DoubledCoord.QdoubledFromCube(h1.Neighbor(4));
        DoubledCoord d1n5 = DoubledCoord.QdoubledFromCube(h1.Neighbor(5));
    }
Beispiel #2
0
    static public void TestDoubledRoundtrip()
    {
        Hex          a = new Hex(3, 4, -7);
        DoubledCoord b = new DoubledCoord(1, -3);

        Tests.EqualHex("conversion_roundtrip doubled-q", a, DoubledCoord.QdoubledFromCube(a).QdoubledToCube());
        Tests.EqualDoubledcoord("conversion_roundtrip doubled-q", b, DoubledCoord.QdoubledFromCube(b.QdoubledToCube()));
        Tests.EqualHex("conversion_roundtrip doubled-r", a, DoubledCoord.RdoubledFromCube(a).RdoubledToCube());
        Tests.EqualDoubledcoord("conversion_roundtrip doubled-r", b, DoubledCoord.RdoubledFromCube(b.RdoubledToCube()));
    }