Ejemplo n.º 1
0
    def __init__(self):
        super(Confined, self).__init__()
        self.name = "Random balls centre falling"
        xlow, xhi = -20, 20
        ylow, yhi = 0, 40
        n_circles = 100
        sigma_coef = 1.3

        new_confined_clustered_circles_world(self.world,
                                             n_circles,
                                             p_ll=b2Vec2(xlow, ylow),
                                             p_hr=b2Vec2(xhi, yhi),
                                             radius_range=(1, 1),
                                             sigma=sigma_coef,
                                             seed=None)
        print("finished world generation -- break here if you need to :)")
Ejemplo n.º 2
0
from Box2D import b2Vec2, b2World, b2_dynamicBody
from gen_world import new_confined_clustered_circles_world
from sim_types import SimData
from sph.gridsplat import body_properties

if __name__ == "__main__":
    #uncomment to get the seed of a specific (working) configuration
    # np.random.seed(None);st0 = np.random.get_state();print(st0);np.random.set_state(st0)
    xlow, xhi = -5, 2
    ylow, yhi = 0, 15
    n_circles = 3
    sigma_coef = 1.3
    world = b2World(doSleep=False)
    world.userData = SimData("sim2grid")
    new_confined_clustered_circles_world(world,
                                         n_circles,
                                         p_ll=b2Vec2(xlow, ylow),
                                         p_hr=b2Vec2(xhi, yhi),
                                         radius_range=(1, 1),
                                         sigma=sigma_coef,
                                         seed=None)
    df = body_properties(world)
    print("world converted to dataframe:\n", df, "\n\n")
    print("indexing into dataframe to query about body 3's mass : ",
          df.loc[3, "mass"])