def __init__(self, delimitation_x, delimitation_y): """Constructeur Parameters: delimitation_x/ delimitation_y (tuple): largeur/hauteur du cadrant dans lequel se trouve le triangle """ self.points = [random_point(delimitation_x, delimitation_y), random_point(delimitation_x, delimitation_y), random_point(delimitation_x, delimitation_y)]
def rand_trace(): """ random trace """ m = args['M'] size = args['size'] t_min = args['t_min'] t_max = args['t_max'] result = [] for i in xrange(m): time_slice = [] n = random.randint(t_min, t_max) temp = [random.random() for j in xrange(n)] total = sum(temp) weights = [t / total for t in temp] x, y = random_point(*size) for j in xrange(n): time_slice.append(((i, x, y), weights[j])) x, y = next_location(x, y) result.append(time_slice) return result
def rand(): """randomly distributed""" m = args['M'] size = args['size'] result = [] for i in xrange(m): time_slice = [] x, y = random_point(*size) time_slice.append(((i, x, y), 1)) result.append(time_slice) return result