Skip to content

fix Vector.__eq__() #2

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

Merged
merged 2 commits into from
Nov 21, 2018
Merged

Conversation

justbuchanan
Copy link
Member

@justbuchanan justbuchanan commented Nov 18, 2018

I think the previous implementation was just doing a pointer comparison so two unique vectors with the same contents would not be considered equal.

@Peque
Copy link
Contributor

Peque commented Nov 18, 2018

@justbuchanan Maybe add a test to https://github.com/CadQuery/cadquery/blob/master/tests/TestCadObjects.py ? 😇

@adam-urbanczyk It seems there is a .travis.yml file, but Travis is not set up in the project (?).

@adam-urbanczyk
Copy link
Member

@justbuchanan good catch. Did you consider using the IsEqual method of the underlying OCC object (gp_Vec)?

@Peque indeed. This is a fork of my repo, that is why. Anyhow, I added it to travis and appveyor.

@justbuchanan
Copy link
Member Author

justbuchanan commented Nov 18, 2018

@adam-urbanczyk thanks, I thought I checked for a builtin function, but somehow I missed IsEqual(). I switched to that and added a test case. The IsEqual() method has two required arguments for linear tolerance and angular tolerance. I put in arbitrary small values for those, but open to better suggestions.

@adam-urbanczyk
Copy link
Member

@justbuchanan looks good to me. Maybe change the tolerance from 1e-5 to 1e-6?

@dcowden @jmwright any thoughts? If not I will merge.

@dcowden
Copy link
Member

dcowden commented Nov 19, 2018

this seems fine to me. i think hard-coding the tolerance is probably a mistake,though. The implications of tolerance and equals run very deep, especially when you get into things like geometry fixing and stuff like that.

I think the ideal would be to test for equality, but then have a way to reference a single defined geometric tolerance, which can be changed one place. But i'm not sure the best way to accomplish that

@adam-urbanczyk
Copy link
Member

OK merging and will add an issue about the tolerance handling.

@justbuchanan thanks for your contribution!

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

Successfully merging this pull request may close these issues.

4 participants