ON_PolylineCurve parameter vector (m_t[]) initialisation

As a suggestion, it would be convenient if the call to ON_PolylineCurve::ON_PolylineCurve( const ON_3dPointArray& L ), which uses ON_PolylineCurve& ON_PolylineCurve::operator=( const ON_3dPointArray& src ) to initialise the parameter space vector m_t, initialised the parameter space vector so that its values corresponded to the length along the polyline curve, rather than it initialising it to a uniform vector based on the span number. Doing this would make it consistent with the behaviour of ON_ArcCurve and ON_LineCurve.

Hi @stephen.banks,

I’ve logged your wish - https://mcneel.myjetbrains.com/youtrack/issue/RH-69790.

In the mean time, you might want to use something like this:

/// <summary>
/// Sets a polyline curve to use arc length parameterization
/// for higher quality geometry.
/// </summary>
/// <param name="curve">The polyline curve to modify.</param>
/// <param name="tolerance">Minimum distance tolerance.</param>
void ON_PolylineCurve_SetArcLengthParameterization(
  ON_PolylineCurve& curve,
  double tolerance
  ON_Polyline& polyline = curve.m_pline;
  double d, mind = tolerance;
  curve.m_t[0] = 0;
  const int count = polyline.Count();
  for (int i = 1; i < count; i++)
    d = (polyline[i] - polyline[i - 1]).Length();
    if (d < mind)
      d = mind;
    if (d < fabs(curve.m_t[i - 1]) * 1e-5)
      d = fabs(curve.m_t[i - 1]) * 1e-5;
    curve.m_t[i] = curve.m_t[i - 1] + d;


– Dale

Thanks, @dale. I’ve ended up implementing something like you suggested.

I guess my original post was a kneejerk reaction in response to combining different curve classes to construct an ON_PolyCurve (using ON_JoinCurves), and then when I got the nurbs form of that ON_PolyCurve, the parameter domain proportionality with 3d space varied significantly. This ultimately demonstrated deficiences in how some software interpolates NURBS, which was most obvious in the displayed curves looking nothing like the underlying geometry, among other consequences (I’m sharing this here in case anyone else encounters a similar issue to help accelerate their diagnostics).

Having said that, similar additional arguments could be also made for this change to those I made in a previous post: Suggestion for Rhino3dm in .NET Rhino.Geometry.Line.ToNurbsCurve() function

Best regards,

RH-69790 is fixed in the latest WIP.