Closed MobiZaman closed 3 years ago
I am using these positions for the embedding, and not applying another layout on it in TSM.
For ease of understanding, I labelled the figure:
The external face should be f3, but it is choosing f12 as well the external face. The corner point selected for choosing the external face is 7.
I followed the best answer from this post for finding the outer face. It seems to be working correctly, though I haven't tested it out for many graphs.
`def get_external_face(self): if len(self.pos) < 2: return list(self.dcel.faces.values())[0]
#find the leftmost node
corner_node = min(self.pos, key=lambda k: (self.pos[k][0], self.pos[k][1]))
print (corner_node)
print(self.G.adj[corner_node])
#find the arc with the largest slope
other = max(self.G.adj[corner_node],
key=lambda node: (self.pos[node][1] - self.pos[corner_node][1]) / (self.pos[node][0] - self.pos[corner_node][0]))
#get the left face of the arc
return self.dcel.half_edges[corner_node, other].twin.inc`
Thank you so much. Your solution is right, except that it may lead to division by zero
error. I have fixed it in lastest commit.
Oh yes, you are right. In wanting a quick solution, I forgot to consider that. Thanks a lot!
I am running the following code:
So, basically I have positions of nodes and data of edges and I am constructing a graph with this data. Then I run the code with only planarization i.e. I am not running orthogonalization or compaction. The external face is determined incorrectly for this case.