Bug in Curve.Offset

Using the Curve.Offset command, I get the following offset curve at the transition to a sharp corner:


Reproducing this with _Offset or _OffsetMultiple in the GUI, everything works as expected:

Corner in question:

The code used is:

Curve[] moved_curves = curve.Offset(curve_plane, -Line_Distance * (m + 1), RhinoMath.ZeroTolerance, CurveOffsetCornerStyle.Round);

curve_plane is the plane constructed by Curve.TryGetPlane, LineDistance is a double and m is an int.

Is this a bug? Or an weird, but expected behaviour?

Hi Alexander,

A shot in the dark to explain the different behaviour:
What is the origin point of the plane?
It might be oddly positioned and explain the different result from the GUI command

Also you are using ZeroTolerance whereas the GUI command will likely use document tolerance.


As the plane is constructed from the original (outermost) curve, the origin is coincident with this outermost curve. And thus is outside of all offset curves.

I also set the tolerance in the Gui to 1e-12 to match ZeroTolerance.

How does th origin of the plane impact the curve?

Hi @alexander.meyer,

Can you post a model with the curved that is failing in RhinoCommon?


– Dale

Sure, here:
sample.3dm (73.0 KB)
sample_cube.3dm (30.2 KB)

sample.3dm contains the curve and the (failed) filling. The curves are generated as conture curves from the cube in sample_cube.3dm with Mesh.CreateContourCurves(geometry as Mesh, intersection_plane);, as outlined in this example: https://developer.rhino3d.com/samples/rhinocommon/create-contour-curves/

The offsets are generated with

Curve[] moved_curves = curve.Offset(curve_plane, -group.Fill_Line_Distance * (m + 1), RhinoMath.ZeroTolerance, CurveOffsetCornerStyle.Round);

and curve plane by

Plane curve_plane;
curve.TryGetPlane(out curve_plane, RhinoMath.ZeroTolerance);

Thanks in advance,