BHoM / BHoM_Engine

Internal manipulation of the BHoM
GNU Lesser General Public License v3.0
26 stars 13 forks source link

Geometry_Enigne: Full refactor of polyline offset #3394

Open IsakNaslundBh opened 1 month ago

IsakNaslundBh commented 1 month ago

NOTE: Depends on

https://github.com/BHoM/BHoM/pull/1632

Issues addressed by this PR

Closes #3235 also should resolve all issues for polylines in #1333. Leaving that issue open though, as PolyCurves are not handled by this PR.

Full refactor of Polyline offset.

Test files

Changelog

Additional comments

Started this off as a little side project, that ended up as a quite massive PR, as I went through and thought of more and more edge cases to be handled. Think this now, thoguh, should be really quite stable as well as quick and able to handle many many weird and wonderful edge cases.

The main offset method could for some cases return ever so slightly different results compared to before, but I am pretty confident that what it doing now is more sane and reliable, and gives better control over the behaviour.

Logic I have put in place (by default) is for the offset curve once a self-intersection occurs, is to keep the part with largest area for a closed curve, and always keep the start and end bits for an open curve. Could ofc be changed to longest length or something like that instead, but area, and start and end felt the most sensible to me. as a starting point.

A lot of the code gets a wee bit complex in places, and there is quite a lot of vector maths going on that I have tried to comment as much as possible. Happy to have a chat through it though.

IsakNaslundBh commented 1 month ago

@BHoMBot check compliance

bhombot-ci[bot] commented 1 month ago
@IsakNaslundBh to confirm, the following actions are now queued: - check `code-compliance` - check `documentation-compliance` - check `project-compliance` - check `branch-compliance` - check `dataset-compliance` - check `copyright-compliance` There are 14 requests in the queue ahead of you.
bhombot-ci[bot] commented 1 month ago
@IsakNaslundBh to confirm, the following actions are now queued: - check `code-compliance` - check `documentation-compliance` - check `project-compliance` - check `branch-compliance` - check `dataset-compliance` - check `copyright-compliance` There are 4 requests in the queue ahead of you.