示例#1
0
def create_random_shapes(n, shape_db):

    for x in range(n):
        if random.random() > 0.5:
            shape = mdl.create_random_sphere()
            #shape = create_sphere()
        else:
            #shape = create_plane()
            shape = mdl.create_random_plane()
        shape_db.add_shape(shape)
示例#2
0
def create_random_shapes(n, shape_db):

    for x in range(n):
        if random.random() > 0.5:
            shape = mdl.create_random_sphere()
            #shape = create_sphere()
        else:
            #shape = create_plane()
            shape = mdl.create_random_plane()
        shape_db.add_shape(shape)
示例#3
0
文件: grid.py 项目: mario007/renmas
    z = random.random() * 10.0

    dir_x = random.random() * 10.0 - 5.0
    dir_y = random.random() * 10.0 - 5.0
    dir_z = random.random() * 10.0 - 5.0

    origin = Vector3(x, y, z)
    direction = Vector3(dir_x, dir_y, dir_z)
    direction.normalize()
    ray = Ray(origin, direction)
    return ray


if __name__ == "__main__":
    
    sph1 = mdl.create_random_sphere()
    #sph2 = mdl.create_random_sphere()
    #sph3 = mdl.create_random_sphere()

    for x in range(10000):
        sph3 = mdl.create_random_sphere()
    

    grid = Grid()
    t = timeit.Timer(lambda :grid.setup())
    print ("time", t.timeit(1))

    grid.setup()
    for n in range(100):
        ray = generate_ray()
示例#4
0
文件: grid.py 项目: mario007/renmas
    z = random.random() * 10.0

    dir_x = random.random() * 10.0 - 5.0
    dir_y = random.random() * 10.0 - 5.0
    dir_z = random.random() * 10.0 - 5.0

    origin = Vector3(x, y, z)
    direction = Vector3(dir_x, dir_y, dir_z)
    direction.normalize()
    ray = Ray(origin, direction)
    return ray


if __name__ == "__main__":

    sph1 = mdl.create_random_sphere()
    #sph2 = mdl.create_random_sphere()
    #sph3 = mdl.create_random_sphere()

    for x in range(10000):
        sph3 = mdl.create_random_sphere()

    grid = Grid()
    t = timeit.Timer(lambda: grid.setup())
    print("time", t.timeit(1))

    grid.setup()
    for n in range(100):
        ray = generate_ray()

        hp2 = isect_ray_scene(ray)