Esempio n. 1
0
    private static void test03()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST03 tests SPHERE_ICOS2_POINTS.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    29 August 2010
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        Console.WriteLine("");
        Console.WriteLine("TEST03");
        Console.WriteLine("  SPHERE_ICOS_POINT_NUM \"sizes\" a grid generated");
        Console.WriteLine("  on an icosahedron and projected to a sphere.");
        Console.WriteLine("  SPHERE_ICOS2_POINTS creates the grid.");

        const int factor = 3;

        Console.WriteLine("");
        Console.WriteLine("  Sizing factor FACTOR = " + factor + "");

        int node_num = Icosphere.sphere_icos_point_num(factor);

        Console.WriteLine("");
        Console.WriteLine("  Number of nodes =     " + node_num + "");

        double[] node_xyz = Icosphere.sphere_icos2_points(factor, node_num);

        typeMethods.r8mat_transpose_print_some(3, node_num, node_xyz, 1, 1, 3, 20,
                                               "  Initial part of NODE_XYZ array:");
        //
        //  Write the nodes to a file.
        //
        string filename = "sphere_grid_icos2_points_f" + (factor, "%d")
                          + ".xyz";

        typeMethods.r8mat_write(filename, 3, node_num, node_xyz);

        Console.WriteLine("");
        Console.WriteLine("  Wrote data to \"" + filename + "\"");
    }
Esempio n. 2
0
    private static void test01()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST01 tests SPHERE_ICOS_POINT_NUM.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    29 August 2010
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int edge_num;
        int factor;
        int factor_log;
        int node_num;
        int triangle_num;

        Console.WriteLine("");
        Console.WriteLine("TEST01");
        Console.WriteLine("  SPHERE_ICOS_POINT_NUM determines the size");
        Console.WriteLine("  (number of vertices, edges and faces) in a grid");
        Console.WriteLine("  on a sphere, made by subdividing an initial");
        Console.WriteLine("  projected icosahedron.");
        Console.WriteLine("");
        Console.WriteLine("  N determines the number of subdivisions of each");
        Console.WriteLine("  edge of the icosahedral faces.");
        Console.WriteLine("");
        Console.WriteLine("         N         V         E         F");
        Console.WriteLine("  --------  --------  --------  --------");
        Console.WriteLine("");

        for (factor = 1; factor <= 20; factor++)
        {
            node_num     = Icosphere.sphere_icos_point_num(factor);
            edge_num     = Icosphere.sphere_icos_edge_num(factor);
            triangle_num = Icosphere.sphere_icos_face_num(factor);
            Console.WriteLine("  " + factor.ToString().PadLeft(8)
                              + "  " + node_num.ToString().PadLeft(8)
                              + "  " + edge_num.ToString().PadLeft(8)
                              + "  " + triangle_num.ToString().PadLeft(8) + "");
        }

        Console.WriteLine("");
        Console.WriteLine("  Repeat, but using N constrained by doubling:");
        Console.WriteLine("");
        Console.WriteLine("         N         V         E         F");
        Console.WriteLine("  --------  --------  --------  --------");
        Console.WriteLine("");

        factor = 1;
        for (factor_log = 0; factor_log <= 10; factor_log++)
        {
            node_num     = Icosphere.sphere_icos_point_num(factor);
            edge_num     = Icosphere.sphere_icos_edge_num(factor);
            triangle_num = Icosphere.sphere_icos_face_num(factor);
            Console.WriteLine("  " + factor.ToString().PadLeft(8)
                              + "  " + node_num.ToString().PadLeft(8)
                              + "  " + edge_num.ToString().PadLeft(8)
                              + "  " + triangle_num.ToString().PadLeft(8) + "");
            factor *= 2;
        }
    }