Esempio n. 1
0
 public Hexagon(float x, float y, float side, eFirstPoint efirstpoint)
 {
     HexInit(x, y, side, efirstpoint);
 }
Esempio n. 2
0
        private void HexInit(float x, float y, float side, eFirstPoint efirstpoint)
        {
            this.HexSideLength = side;
            hexside_F = this.HexSideLength;
            hexside_D = (double)hexside_F;
            longside = (float)(hexside_D / 2D * Math.Sqrt(3D));
            shortside = hexside_F / 2;
            this.SW = new HexPoint();
            switch (efirstpoint)
            {
                case eFirstPoint.SW:
                    this.SW.X = x;
                    this.SW.Y = y;
                    break;
                case eFirstPoint.SE:
                    this.SW.X = x - side;
                    this.SW.Y = y;
                    break;
                case eFirstPoint.E:
                    this.SW.X = x - side - shortside;
                    this.SW.Y = y + longside;
                    break;
                case eFirstPoint.NE:
                    this.SW.X = x - side;
                    this.SW.Y = y + (2 * longside);
                    break;
                case eFirstPoint.NW:
                    this.SW.X = x;
                    this.SW.Y = y + (2 * longside);
                    break;
                case eFirstPoint.W:
                    this.SW.X = x + shortside;
                    this.SW.Y = y + longside;
                    break;
            }

            this.HexSideLength = side;
            SetPoints();
            SetSides();
        }