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
Sketch: Fix algorithm seeking for missing coincidences in Validate #6393
Conversation
bool operator()(const VertexIds& x, | ||
const VertexIds& y) const | ||
{ | ||
return (x.GeoId < y.GeoId || ((x.GeoId == y.GeoId) && (x.PosId < y. PosId))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't PosIdSketcher::PointPos
now an enum class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AjinkyaDahale yes it is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then is <
appropriate here? Also, if I understand it correctly end=2
and mid=3
, which could be troublesome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a problem. 'LESS' comparing functions should just ensure a transitive ordering in all cases, and that when 2 equal objects are compared, it returns false in both argument orders. ;)
de0a4d1
to
d20c44b
Compare
The PR causes a crash when using chrisb's sketch example. For more details see above comments. |
Actually the crash comes from the VertexID_Less comparator (which probably is called with an empty thing). Debugger is warming up. Thx for review. |
d20c44b
to
1b65c81
Compare
@wwmayer Should everything be OK now. I tested on more test cases (actually I missed the simplest ones, which actually were the most significant). |
I will have a new look in the next couple of days. |
Works as expected now. Here is the mandatory unit test to see that current master will fail: 6e4c618 |
Please next time just let me know that a test is expected. Actually I didn't add it because I (wrongly) was pretty sure that this function can't be called from Python. I'll add another one that allowed me to find another flaw in my algorithm. ;) |
A unit test is basically always expected. Although Qt has a test module to test GUI intersections I don't expect a function for this kind of stuff.
I didn't know about the exposed function either and so I simply searched in the code base. If there weren't one I would have written a wrapper for it. |
https://forum.freecadweb.org/viewtopic.php?f=8&t=62936