Geometry_Engine: Add Fillet method for Polylines - #3610
Conversation
|
@BHoMBot check required |
|
@Chrisshort92 to confirm, the following actions are now queued:
|
|
The finding: the expected values in these datasets were generated under .NET Framework and are now being checked on .NET 6, and the harness stores and compares them in a way that can't absorb the difference. That bites twice. Where a test's output is a string containing a number, .NET Core 3.0 changed the default double.ToString() from 15 significant digits to shortest-round-trippable, so the identical double now prints as 6.000262860000012 instead of the stored 6.00026286000001 and the exact string comparison fails. Where the output is numeric, the harness compares with an absolute NumericTolerance = 1e-12 against mm-scale coordinates up to 7.3e6 — magnitudes at which one ULP of a double is already 9.3e-10, so the tolerance is finer than a single bit and the test effectively demands bit-exact reproduction across runtimes. 51 of the 72 numeric failures are 1–3 ULP apart, i.e. ordinary JIT/runtime variation that no code change can fix. Adding Fillet.cs is incidental: the failures reproduce byte-for-byte with it absent. The one caveat: the runtime switch explains the string diffs and the sub-3-ULP numeric ones, but not the 21 larger differences (PlaneIntersections expecting -1022.77 and getting 1.50). Those are too big to be precision artefacts — likely list ordering — and are a genuine open question for the geometry owners, just not one this PR caused. |
quick comment on this: It is a known issue, that ofc needs to be resolved properly. In the meantime, though, if you re-create the unittests in RHino 7 (or set GH for rhino 8 to run in framework) and reserialise them, then they should be passing on the bot. To get this PR merged that will be unfortunately be required. |
|
Covered in the documentation here: |
|
@BHoMBot check required |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 30 requests in the queue ahead of you. |
|
@BHoMBot copyright-compliance |
|
@Chrisshort92 sorry, I didn't understand. |
|
@BHoMBot check copyright-compliance |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 9 requests in the queue ahead of you. |
|
@BHoMBot check dataset-compliance |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 9 requests in the queue ahead of you. |
|
@BHoMBot check unit-tests |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 11 requests in the queue ahead of you. |
peterjamesnugent
left a comment
There was a problem hiding this comment.
Comments below.
In your test script this fillet is only 1.719 whilst the input is 1.83:

Can you clean up the comments in the file please - some seem like reasoning and should be cleaned up for merging.
Also, does your test script/unit test cover most cases? Is there one for covering where the radius is greater than the line segment? What about short segments where the points are near co-incident?
|
@BHoMBot check ready-to-merge |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 99 requests in the queue ahead of you. |
|
The check |
IsakNaslundBh
left a comment
There was a problem hiding this comment.
Reviewed this in a call with @peterjamesnugent and think it seem to be working well.
Only thing I would change is the below.
Will just put as a comment review so that this can be re-approved without having to rely on me once this has been fixed.
IsakNaslundBh
left a comment
There was a problem hiding this comment.
Missed the comment
|
@BHoMBot check required |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 10 requests in the queue ahead of you. |
peterjamesnugent
left a comment
There was a problem hiding this comment.
Tested this, and the change has been implemented.
Unit tests needs to be added for 0 radii.
|
@BHoMBot check required |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 12 requests in the queue ahead of you. |
|
The check |
|
The check |
|
@BHoMBot unit-tests |
|
@Chrisshort92 sorry, I didn't understand. |
|
@BHoMBot check copyright-compliance |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 9 requests in the queue ahead of you. |
|
@BHoMBot check dataset-compliance |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 9 requests in the queue ahead of you. |
|
@BHoMBot check unit-tests |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 11 requests in the queue ahead of you. |
|
@BHoMBot check ready-to-merge |
|
@Chrisshort92 to confirm, the following actions are now queued:
There are 13 requests in the queue ahead of you. |
peterjamesnugent
left a comment
There was a problem hiding this comment.
Changes addressed - happy to merge.
|
@BHoMBot check ready-to-merge |
|
@peterjamesnugent to confirm, the following actions are now queued:
There are 9 requests in the queue ahead of you. |




NOTE: Depends on
Issues addressed by this PR
Closes #3609
Rounds every internal corner of a Polyline with a circular arc of the given radius, trimming each adjacent segment back to make room. Corners that can't take the requested radius (too sharp, too close to an end, or running straight through) are capped or left sharp rather than dropped, so the output is always a single contiguous
PolyCurve.Test files
https://burohappold.sharepoint.com/:f:/r/sites/BHoM/02_Current/12_Scripts/02_Pull%20Request/BHoM/BHoM_Engine/Geometry_Engine/%233610-add-fillet-function-for-polylines?d=w4aa8a6b5b8874c5f89f2c8358676f604&csf=1&web=1&e=nMEp3F
Changelog
-
Modify.Fillet()added toGeometry_Engineto round corners ofpolylines, providing the newpolycurveAdditional comments
Offset.csalready has a privateFillet(ICurve, ICurve, ...)helper, used internally to reconnect two offset curve segments that have drifted apart. Despite the name, it doesn't round anything: it extends or trims the two existing curves (a Line stays a Line, an Arc keeps its original radius) until they meet at their mutual intersection, producing a sharp, mitred joint. No radius is involved and no new curve is created.This PR's
Fillet(this Polyline, double radius, ...)does something different: given one Polyline and a target radius, it trims each segment back from every corner and inserts a new circular Arc of that radius, tangent to both sides, producing an actually rounded corner and a single continuous curve.The two share a name by coincidence — the private method carries a stale TODO: make it public comment that this PR does not fulfil as they are target different functions. They solve unrelated problems (sharp-joining two disconnected curves vs. rounding one polyline's corners with a chosen radius), so the private method is left in place rather than replaced.