OffsetCurve results into strange result

I have encountered a strange case where the OffsetCurve returns an unexpected result:

This might be related to this post from 2013:
Offset Curve: inside corners, strange behavior - Rhino / Rhino for Windows - McNeel Forum

CrvToOffset.3dm (94.3 KB) (226 Bytes)

Best Peter

Yep, this is one of Rhino’s weak points. If you add a point at the curve centroid and then run Offset in native Rhino (not the script) and use the centroid as the point indicating the offset direction, it fails. It can’t seem to handle that slight kink (where the bad offset happens) and the curve centroid in this case is the closest point to that kink (look at the tracking line while doing the offset). Anywhere you click where the tracking line (line to closest point on the curve) hits that kink will be a bad offset. Clicking somewhere else results in a good offset.

As the script is automatic, while it might work OK in 99% of other cases, on this particular curve it will fail unfortunately.

The workaround (also not 100% guaranteed) would be to use the RhinoCommon offset method that does not require a point input to determine the offset side. You end up having to offset both sides and then choose which of the two is the ‘inside’ curve you want. The following script does that. (5.0 KB)

1 Like

Thank you for the script! Its kind of a relieve to know why the offset doesnt work in some cases. I have a huge amount of input data and I will try out out how reliable the rhino common methode is.

Unfortunately, the rhino common method seams to encounter the same issue in some situations.

The Curve.Offset Method works with a plane to determine on which side the offset will be. (I guess the origin of the plane?). Since the plane is right on the start point of the curve, it should work, but it doesn’t work always.

Maybe a (bad) workaround would be to check the length of the offset and compare it to the length of the original curve. If the difference is too big, run the offset again with a different reference point?

Yes, I once had a script that would try to do that, move along the curve and try at different points. But in certain situations it is still difficult to determine which one of the results is the correct one (if any).

I was just surprised, that if you run the regular Rhino _Offset command, the preview of the resulting offset doesn’t change even if you pick a “bad” reference point. Considering that the preview of the offset is calculated similar to the actual offset, maybe there is just a small bug with the crv.offset method. It would be great if that could be fixed in future releases;

I put this post into the bug system to make sure it gets looked at: