128 |
a["conns"].append(node["cs"]) |
a["conns"].append(node["cs"]) |
129 |
b["conns"].append(node["cs"]) |
b["conns"].append(node["cs"]) |
130 |
|
|
131 |
rng = Random(self.seed2) |
if self.seed2 != None: |
132 |
nodes0 = nodes |
rng = Random(self.seed2) |
133 |
while nodes0: |
nodes0 = nodes |
134 |
x = rng.choice(nodes0) |
while nodes0: |
135 |
|
x = rng.choice(nodes0) |
136 |
def p2(x, y): |
|
137 |
return filter(lambda z: z in y["conns"], x["conns"]) |
def p2(x, y): |
138 |
|
return filter(lambda z: z in y["conns"], x["conns"]) |
139 |
nodes1 = filter(lambda y: y != x and y["cs"] not in x["conns"], |
|
140 |
nodes) |
nodes1 = filter(lambda y: y != x and y["cs"] not in x["conns"], |
141 |
|
nodes) |
142 |
|
|
143 |
|
if 1: |
144 |
|
if self.path2: |
145 |
|
nodes2 = filter(lambda y: y["cs"] in x["conns"], nodes) |
146 |
|
else: |
147 |
|
nodes2 = nodes1 |
148 |
|
break |
149 |
|
|
|
if 1: |
|
150 |
if self.path2: |
if self.path2: |
151 |
nodes2 = filter(lambda y: y["cs"] in x["conns"], nodes) |
nodes2 = filter(lambda y: p2(x, y), nodes1) |
152 |
else: |
else: |
153 |
nodes2 = nodes1 |
nodes2 = filter(lambda y: not p2(x, y), nodes1) |
154 |
break |
|
155 |
|
if nodes2: break |
|
if self.path2: |
|
|
nodes2 = filter(lambda y: p2(x, y), nodes1) |
|
|
else: |
|
|
nodes2 = filter(lambda y: not p2(x, y), nodes1) |
|
|
|
|
|
if nodes2: break |
|
156 |
|
|
157 |
nodes0 = filter(lambda y: x != y, nodes0) |
nodes0 = filter(lambda y: x != y, nodes0) |
158 |
|
|
159 |
if nodes2: |
if nodes2: |
160 |
y = rng.choice(nodes2) |
y = rng.choice(nodes2) |
161 |
|
else: |
162 |
|
print "Cannot find a pair of nodes of the requested type!!" |
163 |
|
y = None |
164 |
else: |
else: |
165 |
print "Cannot find a pair of nodes of the requested type!!" |
x, y = None, None |
|
y = None |
|
166 |
|
|
167 |
|
|
168 |
def pc(conns, cs): |
def pc(conns, cs): |
174 |
vs.put(getDListNocoords("Color .2 .2 1")) |
vs.put(getDListNocoords("Color .2 .2 1")) |
175 |
vs.put(conns, cs + [node["cs"]] + node["conns"]) |
vs.put(conns, cs + [node["cs"]] + node["conns"]) |
176 |
|
|
177 |
|
if 0: |
178 |
|
for node in [x,y]: |
179 |
|
vs.put(getDList(""" |
180 |
|
PushAttrib ENABLE_BIT CURRENT_BIT |
181 |
|
Disable DEPTH_TEST |
182 |
|
Disable VERTEX_PROGRAM_ARB |
183 |
|
Color 1 .25 .25 |
184 |
|
LineWidth 3 |
185 |
|
Begin LINES |
186 |
|
Vertex 0 %(k2)s |
187 |
|
Vertex %(k)s %(k2)s |
188 |
|
Vertex %(k2)s 0 |
189 |
|
Vertex %(k2)s %(k)s |
190 |
|
End |
191 |
|
PopAttrib |
192 |
|
Color .2 .2 1 |
193 |
|
""" % { "k" : self.size, "k2" : self.size * .5}), node["cs"]) |
194 |
|
|
195 |
light3d.drawFillets(self, vs, pc) |
light3d.drawFillets(self, vs, pc) |
196 |
|
|
197 |
def scene(self, vs): |
def scene(self, vs): |