Exemplo n.º 1
0
def generate_plates_simulation(seed,
                               width,
                               height,
                               sea_level=0.65,
                               erosion_period=60,
                               folding_ratio=0.02,
                               aggr_overlap_abs=1000000,
                               aggr_overlap_rel=0.33,
                               cycle_count=2,
                               num_plates=10,
                               verbose=get_verbose()):

    if verbose:
        start_time = time.time()
    p = platec.create(seed, width, height, sea_level, erosion_period,
                      folding_ratio, aggr_overlap_abs, aggr_overlap_rel,
                      cycle_count, num_plates)

    while platec.is_finished(p) == 0:
        # TODO: add a if verbose: message here?
        platec.step(p)
    hm = platec.get_heightmap(p)
    pm = platec.get_platesmap(p)
    if verbose:
        elapsed_time = time.time() - start_time
        print("...plates.generate_plates_simulation() complete. " +
              "Elapsed time " + str(elapsed_time) + " seconds.")
    return hm, pm
Exemplo n.º 2
0
 def world(self):
     world = World(self.name, self.width, self.height, self.seed,
                   self.n_plates, self.ocean_level,
                   Step.get_by_name("plates"))
     hm = platec.get_heightmap(self.p)
     pm = platec.get_platesmap(self.p)
     world.set_elevation(array_to_matrix(hm, self.width, self.height), None)
     world.set_plates(array_to_matrix(pm, self.width, self.height))
     return world
Exemplo n.º 3
0
 def world(self):
     world = World(self.name, self.width, self.height, self.seed,
                   self.n_plates, self.ocean_level,
                   Step.get_by_name("plates"))
     hm = platec.get_heightmap(self.p)
     pm = platec.get_platesmap(self.p)
     world.set_elevation(array_to_matrix(hm, self.width, self.height), None)
     world.set_plates(array_to_matrix(pm, self.width, self.height))
     return world
Exemplo n.º 4
0
 def test_get_platesmap(self):
     seed = 1
     width = 100
     height = 100
     p = platec.create(seed, width, height, 0.65, 60, 0.02, 1000000, 0.33, 2, 10)
     pm = platec.get_platesmap(p)
     platec.destroy(p)
     self.assertEqual(10000, len(pm))
     for v in pm:
         self.assertTrue(10 > v >= 0)
Exemplo n.º 5
0
def generate_plates_simulation(obj, seed, width, height, sea_level=0.65,
                               erosion_period=60, folding_ratio=0.02,
                               aggr_overlap_abs=1000000, aggr_overlap_rel=0.33,
                               cycle_count=2, num_plates=10):

    p = platec.create(seed, width, height, sea_level, erosion_period,
                      folding_ratio, aggr_overlap_abs, aggr_overlap_rel,
                      cycle_count, num_plates)
    # Note: To rescale the worlds heightmap to roughly Earths scale, multiply by 2000.

    while platec.is_finished(p) == 0:
        platec.step(p)
    
    hm = platec.get_heightmap(p)
    pm = platec.get_platesmap(p)
    
    return hm, pm
Exemplo n.º 6
0
def generate_plates_simulation(seed, width, height, sea_level=0.65,
                               erosion_period=60, folding_ratio=0.02,
                               aggr_overlap_abs=1000000, aggr_overlap_rel=0.33,
                               cycle_count=2, num_plates=10,
                               verbose=get_verbose()):

    if verbose:
        start_time = time.time()
    p = platec.create(seed, width, height, sea_level, erosion_period,
                      folding_ratio, aggr_overlap_abs, aggr_overlap_rel,
                      cycle_count, num_plates)

    while platec.is_finished(p) == 0:
        # TODO: add a if verbose: message here?
        platec.step(p)
    hm = platec.get_heightmap(p)
    pm = platec.get_platesmap(p)
    if verbose:
        elapsed_time = time.time() - start_time
        print("...plates.generate_plates_simulation() complete. " +
              "Elapsed time " + str(elapsed_time) + " seconds.")
    return hm, pm
Exemplo n.º 7
0
def generate_plates_simulation(obj,
                               seed,
                               width,
                               height,
                               sea_level=0.65,
                               erosion_period=60,
                               folding_ratio=0.02,
                               aggr_overlap_abs=1000000,
                               aggr_overlap_rel=0.33,
                               cycle_count=2,
                               num_plates=10):

    p = platec.create(seed, width, height, sea_level, erosion_period,
                      folding_ratio, aggr_overlap_abs, aggr_overlap_rel,
                      cycle_count, num_plates)
    # Note: To rescale the worlds heightmap to roughly Earths scale, multiply by 2000.

    while platec.is_finished(p) == 0:
        platec.step(p)

    hm = platec.get_heightmap(p)
    pm = platec.get_platesmap(p)

    return hm, pm