Esempio n. 1
0
def step():

    points = loads(request.args['points'])
    bounds_json = request.args.get('bounds', None)
    bounds = loads(bounds_json) if bounds_json is not None else None
    get_images = bool(request.args.get('get_images', None))

    if len(points) > 0:
        simplex = Simplex()
        new_points = simplex.step(points, bounds)
    else:
        new_points = [
            {
                'value': [0, 0, 0],
                'type': 'vertex'
            },
            {
                'value': [0, 0, 4],
                'type': 'vertex'
            },
            {
                'value': [0, 4, 0],
                'type': 'vertex'
            },
            {
                'value': [4, 0, 0],
                'type': 'vertex'
            },
        ]

    for p in new_points:
        if get_images and 'img' not in p:
            p['img'] = get_cut_image_name(*p['value'])

    return jsonify(**{'points': new_points})
Esempio n. 2
0
 def setUp(self):
     self.simplex = Simplex()