Calculate the deg of trajectory region
Description: Calculate the deg of trajectory region
URI: /algo/deg
http method: GET
@app.route('/algo/deg',methods=['GET'])
def deg():
if not request.json or 'tr' not in request.json or 'rid' not in request.json:
return jsonify({'deg':-1})
tr = request.json['tr']
rid = request.json['rid']
r = set(tr[idx+1] for idx,x in enumerate(tr) if x == rid and idx < len(tr)-1)
return jsonify({'deg':len(r)})