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

fixed unexpected behavior for opposite parallel planes. #1435

Merged
merged 6 commits into from
Feb 6, 2025

Conversation

mattiskoh
Copy link
Contributor

@mattiskoh mattiskoh commented Feb 5, 2025

Plane.is_parallel() does not check for opposite normals and thus returns False for this edge case.

Not the most elegant fix due to the TOL.is_close() hope it's fine like this..

What type of change is this?

  • Bug fix in a backwards-compatible manner.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke lint).
  • [] I added new functions/classes and made them available on a second-level import, e.g. compas.datastructures.Mesh.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Copy link
Member

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for noticing this and proposing a fix...

@mattiskoh mattiskoh requested a review from tomvanmele February 6, 2025 09:40
Copy link
Member

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix is great, but could you add a test that proves the problem is solved?

@mattiskoh
Copy link
Contributor Author

mattiskoh commented Feb 6, 2025

the fix is great, but could you add a test that proves the problem is solved?

Isn't the Docstring Example sufficient..? Or do you guys not run doctest ? Better said why put an example if there is no test for this function...?

@mattiskoh mattiskoh requested a review from tomvanmele February 6, 2025 16:09
@tomvanmele
Copy link
Member

the examples in the docs are tested. however, examples are not necessarily meant to be formulated as tests, but rather explanations for users on how to use the advertised functionality. in many case some of the examples will indeed overlap with some of the tests, but ideally tests for example also address things like boundary cases, which simple examples usually don't.

currently our test coverage is not nearly sufficient, but we are trying to work towards this. therefore i try to make sure that at least new PRs are accompanied by tests, especially when they fix an issue.

i know it is annoying but it needs to be done...

@tomvanmele tomvanmele merged commit 961fdf8 into compas-dev:main Feb 6, 2025
16 checks passed
@jf---
Copy link
Contributor

jf--- commented Feb 10, 2025

nice find @mattiskoh

I wonder whether the fix can be generalised; that is, is a tolerance is an unsigned value in general? Intuitively the suggested fix might just be broadly applicable.

The precision class of OCCT utilises abs in a nr of cases

https://dev.opencascade.org/doc/refman/html/class_precision.html

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.

3 participants