aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/Shapes/Hexagon.cs
blob: ce256e9b7e6174aa1c5d72ceaba78535c1e53ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;

namespace Tango.SharedUI.Shapes
{
    public class Hexagon : Shape
    {
        public Hexagon() : base()
        {
            this.Stretch = System.Windows.Media.Stretch.Fill;
        }
        protected override Geometry DefiningGeometry
        {
            get { return GetGeometry(); }
        }

        private Geometry GetGeometry()
        {
            double sideLength = 100;
            double x = Math.Sqrt(sideLength * sideLength / 2);
            return Geometry.Parse(String.Format("M {0},0 h {1} l {0},{0} l -{0},{0} h -{1} l -{0},-{0} Z", x, sideLength));
        }
    }
}