示例#1
0
	def get_near_vertices(self, cell, cell_list):
		vlist = sheep.vertex_neighbors(cell)

		for c in vlist:
			if c not in cell_list and not self.share_edge(c, cell_list):
				cell_list.append(c)
		return (cell_list)
示例#2
0
    def next_frame(self):
        while True:

            if self.started_at == 0.0:
                self.started_at = time.time()

            elapsed_time = time.time() - self.started_at

            current_ix = int(math.floor(elapsed_time / self.dwell_time) % len(sheep.ALL))

            self.clear();

            focus = sheep.ALL[current_ix]
            self.both.set_cell(focus, RGB(255,0,0))

            edges = sheep.edge_neighbors(focus)
            print "edges = %s" % str(edges)
            if edges != None:
                for p in edges:
                    self.both.set_cell(p, RGB(0,255,0))

            vertices = sheep.vertex_neighbors(focus)
            if vertices != None:
                for p in vertices:
                    self.both.set_cell(p, RGB(0,0,255))

            yield 0.001
示例#3
0
    def next_frame(self):
        while True:
            for cellnum in sheep.ALL:
                self.sheep.clear()  # unnecessary for it to do a go here?

                col = self.color.copy()
                # set the primary panel to the base color
                self.sheep.set_cell(cellnum, col)

                # set edge neighbors to 80% brightness
                col.v = 0.8
                self.sheep.set_cells(sheep.edge_neighbors(cellnum), col)

                # set vertex neighbors to 20% brightness
                col.v = 0.2
                self.sheep.set_cells(sheep.vertex_neighbors(cellnum), col)

                yield self.speed
示例#4
0
    def next_frame(self):
        while True:
            for cellnum in sheep.ALL:
                self.sheep.clear()  # unnecessary for it to do a go here?

                col = self.color.copy()
                # set the primary panel to the base color
                self.sheep.set_cell(cellnum, col)

                # set edge neighbors to 80% brightness
                col.v = 0.8
                self.sheep.set_cells(sheep.edge_neighbors(cellnum), col)

                # set vertex neighbors to 20% brightness
                col.v = 0.2
                self.sheep.set_cells(sheep.vertex_neighbors(cellnum), col)

                yield self.speed