public CoordinateCalculator produce(MeshType mesh)
        {
            CoordinateCalculator cc = new SquareCoordinateCalculator();

            if (mesh == MeshType.TRIANGLE)
            {
                cc = new TriangleCoordinateCalculator();
            }
            else if (mesh == MeshType.HEXAGON)
            {
                cc = new HexagonCoordinateCalculator();
            }
            else if (mesh == MeshType.PENTAGON1)
            {
                cc = new Pentagon1CoordinateCalculator();
            }
            else if (mesh == MeshType.PENTAGON3)
            {
                cc = new Pentagon3CoordinateCalculator();
            }
            else if (mesh == MeshType.PENTAGON4)
            {
                cc = new Pentagon4CoordinateCalculator();
            }
            else if (mesh == MeshType.KITE5)
            {
                cc = new Kite5CoordinateCalculator();
            }
            else if (mesh == MeshType.PENTAGON10)
            {
                cc = new Pentagon10CoordinateCalculator();
            }
            else if (mesh == MeshType.PENTAGON11)
            {
                cc = new Pentagon11CoordinateCalculator();
            }
            else if (mesh == MeshType.PENTAGON12)
            {
                cc = new Pentagon12CoordinateCalculator();
            }
            else if (mesh == MeshType.PENTAGON14)
            {
                cc = new Pentagon14CoordinateCalculator();
            }
            else if (mesh == MeshType.RECTANGLE1)
            {
                cc = new Rectangle1CoordinateCalculator();
            }
            else if (mesh == MeshType.RECTANGLE2)
            {
                cc = new Rectangle2CoordinateCalculator();
            }
            else if (mesh == MeshType.TILED_RECTANGLE1)
            {
                cc = new TiledRectangle1CoordinateCalculator();
            }
            else if (mesh == MeshType.RECTANGLE_SQUARE)
            {
                cc = new RectangleSquareCoordinateCalculator();
            }
            else if (mesh == MeshType.SQUARE_TRIANGLE1)
            {
                cc = new SquareTriangle1CoordinateCalculator();
            }
            else if (mesh == MeshType.SQUARE_TRIANGLE2)
            {
                cc = new SquareTriangle1CoordinateCalculator();
            }
            else if (mesh == MeshType.HEXAGON_TRIANGLE1)
            {
                cc = new HexagonTriangleCoordinateCalculator();
            }
            else if (mesh == MeshType.OCTOGON_SQUARE)
            {
                cc = new SquareCoordinateCalculator();
            }
            else if (mesh == MeshType.DODECAGON_TRIANGLE)
            {
                cc = new HexagonTriangleCoordinateCalculator();
            }
            else if (mesh == MeshType.HEXAGON_TRIANGLE2)
            {
                cc = new HexagonTriangle2CoordinateCalculator();
            }
            else if (mesh == MeshType.HEXAGON_SQUARE_TRIANGLE)
            {
                cc = new HexagonSquareTriangleCoordinateCalculator();
            }
            else if (mesh == MeshType.DODECAGON_HEXAGON_SQUARE)
            {
                cc = new HexagonSquareTriangleCoordinateCalculator();
            }
            return(cc);
        }
Exemplo n.º 2
0
        public override List <Tuple <double, double> > calculate_polygon_coordinates(int i, int j)
        {
            //For the mesh PENTAGON10
            SquareCoordinateCalculator rc = new SquareCoordinateCalculator();

            List <Tuple <double, double> > squareCoords = rc.calculate_polygon_coordinates(i / 4, j / 4);
            Tuple <double, double>         nullCoords   = squareCoords[0];
            Tuple <double, double>         oneCoords    = squareCoords[2];

            double x0  = nullCoords.Item1 * 2;
            double y0  = nullCoords.Item2 * 2;
            double x1  = oneCoords.Item1 * 2;
            double y1  = oneCoords.Item2 * 2;
            double x05 = (x0 + x1) / 2;
            double y05 = (y0 + y1) / 2;

            Tuple <double, double>         p0     = new Tuple <double, double>(x0, y0);
            Tuple <double, double>         p1     = new Tuple <double, double>(x1, y0);
            Tuple <double, double>         p2     = new Tuple <double, double>(x1, y1);
            Tuple <double, double>         p3     = new Tuple <double, double>(x0, y1);
            Tuple <double, double>         p4     = new Tuple <double, double>(x05, y05);
            Tuple <double, double>         p5     = new Tuple <double, double>(x05, y0);
            Tuple <double, double>         p6     = new Tuple <double, double>(x05, y1);
            List <Tuple <double, double> > points = new List <Tuple <double, double> >();

            if (i % 2 == 0)
            {
                if (j % 6 == 0)
                {
                    points.Add(p0);
                    points.Add(p4);
                    points.Add(p3);
                }
                else if (j % 6 == 1)
                {
                    points.Add(p1);
                    points.Add(p2);
                    points.Add(p4);
                }
                else if (j % 6 == 2)
                {
                    points.Add(p4);
                    points.Add(p2);
                    points.Add(p3);
                }
                else if (j % 6 == 3)
                {
                    points.Add(p0);
                    points.Add(p4);
                    points.Add(p3);
                }
                else if (j % 6 == 4)
                {
                    points.Add(p0);
                    points.Add(p5);
                    points.Add(p6);
                    points.Add(p3);
                }
                else if (j % 6 == 5)
                {
                    points.Add(p5);
                    points.Add(p1);
                    points.Add(p2);
                    points.Add(p6);
                }
            }
            else if (i % 2 == 1)
            {
                if (j % 6 == 0)
                {
                    points.Add(p0);
                    points.Add(p5);
                    points.Add(p6);
                    points.Add(p3);
                }
                else if (j % 6 == 1)
                {
                    points.Add(p5);
                    points.Add(p1);
                    points.Add(p2);
                    points.Add(p6);
                }
                else if (j % 6 == 2)
                {
                    points.Add(p0);
                    points.Add(p4);
                    points.Add(p3);
                }
                else if (j % 6 == 3)
                {
                    points.Add(p1);
                    points.Add(p2);
                    points.Add(p4);
                }
                else if (j % 6 == 4)
                {
                    points.Add(p4);
                    points.Add(p2);
                    points.Add(p3);
                }
                else if (j % 6 == 5)
                {
                    points.Add(p0);
                    points.Add(p4);
                    points.Add(p3);
                }
            }

            return(points);
        }
 public HexagonTriangleCoordinateCalculator()
 {
     this.sgc = new SquareCoordinateCalculator();
 }