public HexagonBuilder SetNextHexagons() { _hex.NearHexagons = new List <Point>(); _hex.NearHexagons.Add( Point.Round( new PointF( _hex.Center.X, (float)(_hex.Center.Y + 2 * GeometryOperation.GetHeight()) ) ) ); _hex.NearHexagons.Add( Point.Round( new PointF( _hex.Center.X + (GeometryOperation.CurSize * 3) / 2, (float)(_hex.Center.Y + GeometryOperation.GetHeight()) ) ) ); _hex.NearHexagons.Add( Point.Round( new PointF( _hex.Center.X + (GeometryOperation.CurSize * 3) / 2, (float)(_hex.Center.Y - GeometryOperation.GetHeight()) ) ) ); _hex.NearHexagons.Add( Point.Round( new PointF( _hex.Center.X, (float)(_hex.Center.Y - GeometryOperation.GetHeight() * 2) ) ) ); _hex.NearHexagons.Add( Point.Round( new PointF( _hex.Center.X - (GeometryOperation.CurSize * 3) / 2, (float)(_hex.Center.Y - GeometryOperation.GetHeight()) ) ) ); _hex.NearHexagons.Add( Point.Round( new PointF( _hex.Center.X - (GeometryOperation.CurSize * 3) / 2, (float)(_hex.Center.Y + GeometryOperation.GetHeight()) ) ) ); return(this); }
private void DenyCenter(Point hexCenter) { int size = 20; int h = (int)Math.Round(GeometryOperation.GetHeight()); int w = (int)Math.Round(GeometryOperation.GetProiection()); Point pointDenied = new Point(hexCenter.X - size, hexCenter.Y - h); _pointsDone.Add(hexCenter); for (int index_x = 0; index_x <= w * 2 + size; index_x++) { for (int index_y = 0; index_y <= h * 2; index_y++) { _pointsDone.Add(new Point(pointDenied.X + index_x, pointDenied.Y + index_y)); } } }
public HexagonBuilder BuildHexagon(Point center) { _hex = new Hexagon() { Center = center, Faces = new List <Face>() }; // Side 1 _hex.Faces.Add(new Face() { Points = new Point[] { Point.Round( new PointF( center.X - GeometryOperation.CurSize / 2, (float)(center.Y + GeometryOperation.GetHeight()) ) ), Point.Round( new PointF( center.X + GeometryOperation.CurSize / 2, (float)(center.Y + GeometryOperation.GetHeight()) ) ) } }); // Side 2 _hex.Faces.Add(new Face() { Points = new Point[] { Point.Round( new PointF( center.X + GeometryOperation.CurSize / 2, (float)(center.Y + GeometryOperation.GetHeight()) ) ), new Point(GeometryOperation.CurSize + center.X, center.Y) } }); // Side 3 _hex.Faces.Add(new Face() { Points = new Point[] { new Point(GeometryOperation.CurSize + center.X, center.Y), Point.Round( new PointF( center.X + GeometryOperation.CurSize / 2, (float)(center.Y - GeometryOperation.GetHeight()) ) ) } }); // Side 4 _hex.Faces.Add(new Face() { Points = new Point[] { Point.Round( new PointF( center.X + GeometryOperation.CurSize / 2, (float)(center.Y - GeometryOperation.GetHeight()) ) ), Point.Round( new PointF( center.X - GeometryOperation.CurSize / 2, (float)(center.Y - GeometryOperation.GetHeight()) ) ) } }); // Side 5 _hex.Faces.Add(new Face() { Points = new Point[] { Point.Round( new PointF( center.X - GeometryOperation.CurSize / 2, (float)(center.Y - GeometryOperation.GetHeight()) ) ), new Point(center.X - GeometryOperation.CurSize, center.Y) } }); // Side 6 _hex.Faces.Add(new Face() { Points = new Point[] { new Point(center.X - GeometryOperation.CurSize, center.Y), Point.Round( new PointF( center.X - GeometryOperation.CurSize / 2, (float)(center.Y + GeometryOperation.GetHeight()) ) ) } }); return(this); }