Commit 65306db5 authored by John Clemens's avatar John Clemens

Fix error in contiguous faces calculation

parent cbc325e7
......@@ -110,6 +110,10 @@ def check_sphere_isomorphism(G, OG):
return False
def check_pattern(P, G):
if len(P.faces) == len(G.faces):
if check_plane_isomorphism(P, G):
return True
parcs = [x for x in P.graph.edges_iter() if
P.graph[x[0]][x[1]]['face'].visible]
arc0 = parcs[0]
......@@ -126,17 +130,19 @@ def check_pattern(P, G):
visible_faces = {x for x in G.faces if x.visible}
if W <= visible_faces and \
W<= G.contiguous_visible_faces(list(W)[0]):
W <= G.contiguous_visible_faces(list(W)[0]):
Gprime = openpg.openpg()
for face in G.faces:
nface = face.copy()
Gprime.add_face(nface)
if face not in W:
found = False
for f in W:
if face.equiv(f):
found = True
if not found:
nface.visible = False
Gprime.normalize()
print 'GPrime: ', Gprime.print_info()
if check_plane_isomorphism(P, Gprime):
return True
return False
......
......@@ -227,16 +227,20 @@ class openpg():
return {x for x in list(face.adjacent()) if x.visible}
def contiguous_visible_faces(self, face, ret=set()):
if not face.visible or face in ret:
if not face.visible:
return ret
for f in ret:
if face.equiv(f):
return ret
ret.add(face)
newfaces = self._adjacent_visible(face)
for f in list(newfaces):
ret.update(self.contiguous_visible_faces(f, ret=ret))
ret.update(newfaces)
#ret.update(newfaces)
return ret
def pendents(self):
......
......@@ -116,16 +116,14 @@ class test_openpg(unittest.TestCase):
def test_check_pattern_same(self):
self.G1.normalize()
self.assertTrue(isomorphic.check_pattern(self.G1, self.G1))
self.assertTrue(isomorphic.check_pattern(self.G1,self.G1))
def test_check_pattern_diff(self):
self.G4.normalize()
self.assertTrue(isomorphic.check_pattern(self.G4, self.G1))
def _0000test_contiguous_faces(self):
G1 = example_graphs.example_graph1()
g1 = list(G1.contiguous_visible_faces(G1.faces[1]))
print g1
def test_contiguous_faces(self):
g1 = list(self.G1.contiguous_visible_faces(self.G1.faces[1]))
self.assertTrue(len(g1) == 4)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment