Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: __lt__() in vis_graph.py #25

Open
TaipanRex opened this issue Mar 12, 2018 · 3 comments
Open

UnboundLocalError: __lt__() in vis_graph.py #25

TaipanRex opened this issue Mar 12, 2018 · 3 comments

Comments

@TaipanRex
Copy link
Owner

same_point is not defined and should be. Initiate to None, then throw an exception if still None after the two if statements. There are instances where a point of a polygon is on the edge of another polygon. That means their distances are equal, but have no common points. same_point therefore does not exist...

@aranciokov
Copy link

if self.edge.p1 in other.edge:
  same_point = self.edge.p1
elif self.edge.p2 in other.edge:
  same_point = self.edge.p2

There's one thing I'm not sure about (which relates to this snippet).
Say we have self.edge = ((5.00, 4.00), (6.00, 3.00)) and other.edge = ((3.00, 0.00), (7.00, 4.00)).
When checking self.edge.p2 in other.edge you are checking (6.00, 3.00) in ((3.00, 0.00), (7.00, 4.00)), right? It gives false (so it goes on and ignores the same_point = ...) and the point (6.00, 3.00) lays on the segment. Is this OK?

@TaipanRex
Copy link
Owner Author

I implemented Pyvisgraph with the assumption that all polygons are distinct, i.e. they do not overlap. That also means that the point of one polygon should not lie on the segment of another. Thats really the consequence here, the code snippet you linked should only be triggered when the two edges are of the same polygon, i.e. they share a common point and therefore their distance is equal.

@TaipanRex
Copy link
Owner Author

A solution is to use Shapely cascaded_union to merge overlapping polygons. That has solved it for one user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants