コード例 #1
0
        // |/|--
        //    \\
        // |/|--
        // --|/|
        // \\
        // --|/|

        public override List <Tuple <double, double> > calculate_polygon_coordinates(int i, int j)
        {
            //For the mesh PENTAGON12
            Rectangle2CoordinateCalculator rc = new Rectangle2CoordinateCalculator();

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

            double x0 = nullCoords.Item1;
            double y0 = nullCoords.Item2;
            double x1 = oneCoords.Item1;
            double y1 = oneCoords.Item2;


            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);
            List <Tuple <double, double> > points = new List <Tuple <double, double> >();

            if (j % 2 == 0)
            {
                points.Add(p0);
                points.Add(p2);
                points.Add(p3);
            }
            else if (j % 2 == 1)
            {
                points.Add(p1);
                points.Add(p2);
                points.Add(p0);
            }


            return(points);
        }
コード例 #2
0
        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);
        }