public ErosionGraph(TectonicUplift uplift_map, int node_count, int terrain_size, double edge_filter_percent)
    {
        this.node_count   = node_count;
        this.uplift_map   = uplift_map;
        this.terrain_size = terrain_size;

        CreateNodes();

        Triangulate();

        RemoveEdges(edge_filter_percent);

        //Erode(1);
    }
    protected void CreateNodes()
    {
        nodes = new List <ErosionNode>(node_count);

        System.Random  rand = new System.Random();
        TectonicUplift fn   = new TectonicUplift(2, 2, 2);
        TectonicUplift fn2  = new TectonicUplift(2, 2, 3);
        TectonicUplift fn3  = new TectonicUplift(2, 2, 4);

        for (int i = 0; i < node_count; i++)
        {
            float x = (float)rand.NextDouble() * terrain_size;
            float y = (float)rand.NextDouble() * terrain_size;
            nodes.Add(new ErosionNode(x, y, fn.get(x, y), (float)(5 * Math.Pow(10, -4)), (float)(5.61 * Math.Pow(10, -7)), 2.0f));
        }
    }
예제 #3
0
    // https://hal.inria.fr/hal-01262376/document

    void Start()
    {
        tectonic_uplift_map = new TectonicUplift(size, 2, 1);
        graph = new ErosionGraph(tectonic_uplift_map, num_sampling_points, size, edge_filter_percent);
    }