Ejemplo n.º 1
0
Archivo: main.py Proyecto: Zebreu/mist
def compute_everything(shapes, directional_tree, other_relationships_tree, table):
    """ Computes relationships between all shapes and stores them in the database """
    for shape1 in shapes:
            for shape2 in shapes:
                if shape1 != shape2:
                    dr = templates.calculate_directions(directional_tree, shape1, shape2)
                    for r in dr:
                        table.relationships.append(r)
                        #print r
                    other = templates.calculate_other_relationships(other_relationships_tree, shape1, shape2)
                    for r in other:
                        #print r
                        table.relationships.append(r)
Ejemplo n.º 2
0
Archivo: main.py Proyecto: Zebreu/mist
def compute_without_opposites(shapes, directional_tree, other_relationships_tree, table):
    """ Computes relationships for all shapes but avoids computing the opposite of the relationships (A against B but not B against A) """
    for i in xrange(len(shapes)):
        shape1 = shapes[i]
        for j in xrange(len(shapes)):
            shape2 = shapes[j]
            if i < j:
                dr = templates.calculate_directions(directional_tree, shape1, shape2)
                for r in dr:
                    table.relationships.append(r)
                other = templates.calculate_other_relationships(other_relationships_tree, shape1, shape2)
                for r in other:
                    table.relationships.append(r)