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

Geometry_Engine: Do not check zero length segments in IsSelfIntersecting #2410

Conversation

IsakNaslundBh
Copy link
Contributor

@IsakNaslundBh IsakNaslundBh commented Mar 19, 2021

Issues addressed by this PR

Closes #2409

This seem to fix the urgent issue in #2393 , but leaving that issue open as a review of the profile creates will be needed to avoid any zero-length segments to be created in the first place.

Test files

https://burohappold.sharepoint.com/:f:/s/BHoM/EqqGnXiRrSVPkYN2v1QyjoIB51GZm6ShUdu-f_E62Hn-YA?e=X5oILq

Changelog

Additional comments

@LMarkowski @pawelbaran would be good if this could be checked quite thoroughly, to ensure this is not causing any issues elsewhere, and to make sure I have not missed any critical reason why this would not be ok!

@IsakNaslundBh IsakNaslundBh self-assigned this Mar 19, 2021
@IsakNaslundBh IsakNaslundBh added the type:bug Error or unexpected behaviour label Mar 19, 2021
@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check unit tests

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 19, 2021

@IsakNaslundBh sorry, I didn't understand.
Was that comment an instruction for me? If so, could you state again what check you would like me to run?
For a list of available instructions, please see this wiki page.

@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot Check Unit Tests

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 19, 2021

@IsakNaslundBh sorry, I didn't understand.
Was that comment an instruction for me? If so, could you state again what check you would like me to run?
For a list of available instructions, please see this wiki page.

@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check unit-tests

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 19, 2021

@IsakNaslundBh to confirm, check-unit-tests task is now queued.

Copy link
Contributor

@rolyhudson rolyhudson left a comment

Choose a reason for hiding this comment

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

Given that these changes are now known not to be the cause of the failing unit tests check.
I think this is a good solution.

We should add a unit test for this method - which should not be based on the profile creates but direct calls from all the Curve inputs.

Other methods that call IsSelfIntersecting directly are:
Normal, Centroid, Offset
All of which have unit tests and these are passing.
OffsetVariable does not yet have a unit test but I cannot see a problem.

Would also be good to get thoughts from others on other methods that may be indirectly calling IsSelfIntersecting and possible impact.

@rolyhudson
Copy link
Contributor

rolyhudson commented Mar 23, 2021

In setting up a batch of unit tests for IsSelfInteresting I note an inconsistency when passing a Polyline with zero length segments to the changed PolyCurve method compared with the Polyline method.

PolyCurve method returns false
Polyline method return true

Should the Polyline method also remove the short(zero) length segments?
List<Line> curves = curve.SubParts().Where(x => x.ILength() > tolerance).ToList();

Also a possible confusion for users is that in Rhino those Curves with zero length segments are marked as Invalid Curves yet they can be handled as valid curves in the BHoM.

@rolyhudson rolyhudson self-requested a review March 23, 2021 09:27
@rolyhudson
Copy link
Contributor

Unit test creation script here

@rolyhudson
Copy link
Contributor

@BHoMBot check unit-tests

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 23, 2021

@rolyhudson to confirm, check-unit-tests task is now queued.

@rolyhudson
Copy link
Contributor

@BHoMBot check unit-tests

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 23, 2021

@rolyhudson to confirm, check-unit-tests task is now queued.

@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check compliance

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 23, 2021

@IsakNaslundBh to confirm, check-code-compliance, check-documentation-compliance, check-project-compliance, check-branch-compliance, check-dataset-compliance, and, if applicable, check-copyright-compliance tasks are now queued.

@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check installer

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 23, 2021

@IsakNaslundBh to confirm, check-installer task is now queued.

@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check core

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 23, 2021

@IsakNaslundBh to confirm, check-core task is now queued.

@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check versioning

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 23, 2021

@IsakNaslundBh to confirm, check-versioning task is now queued.

@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check serialisation

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 23, 2021

@IsakNaslundBh to confirm, check-serialisation task is now queued.

Copy link
Contributor

@rolyhudson rolyhudson left a comment

Choose a reason for hiding this comment

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

Happy with this now.

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 23, 2021

Please be advised that the check with reference 2177645870 has more than 50 annotations of notes. API limitations restrict annotations to 50. You may need to rerun this check to obtain the next set when you make changes. At the time of reporting this check, there are 196 additional annotations waiting, made up of 196 errors and 0 warnings.

@FraserGreenroyd
Copy link
Contributor

@BHoMBot check core

@bhombot-ci
Copy link

bhombot-ci bot commented Mar 23, 2021

@FraserGreenroyd to confirm, check-core task is now queued.

@IsakNaslundBh IsakNaslundBh merged commit ee90185 into master Mar 23, 2021
@IsakNaslundBh IsakNaslundBh deleted the Geometry_Engine-#2409-AvoidShortCurvesForIsSelfIntersecting branch March 23, 2021 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error or unexpected behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Geometry_Engine: IsSelfIntersecting to avoid zero-length lines
3 participants