Equal Length SubCurves (Irrespective of Curvature)

OK, so this problem keeps eluding me: How can I extract sub-segments from (anywhere on) a base curve without the segment-lengths being influenced by the curvature?

I want to do the following using C#, Example:

  1. Pick two subcurves, A & B, with the same “true” curve length
  2. Query using “true” length for both subcurves (say 10mm interval out of a 100 mm long curve)
  3. Query using parameter values (0.1 out of a 1.0 long curve).
  4. Again, in both cases (2 & 3) I want the curve segments to be equally long (within some tol)

Fig. The SubCurve B can start at any point on the curve, illustrated by placing B where the curvature is much different from SubCurve A.

I know how to perform a simple curve division with equal length curve segments like so:

    var crv_points = new List<Point3d>();    
    double t;
    var seg_param = 1.0 / segment_count; // segments as parameterized size 
    for (int i = 0; i < segment_count; i++)
      curve.NormalizedLengthParameter(seg_param * i, out t);

… but I fail to get extract equal length sub-segments (starting from any point on the curve) without their length being influenced by the curvature.

// Rolf

subcurve_2020May21a.gh (13.3 KB)

1 Like

Thank you @Joseph_Oster for replying. I was however looking for a C# solution. That’s where I fail to find my way.

// Rolf

private void RunScript(Curve curve, double start, double length, bool normalize, ref object A)
  double t0,t1;
  if (normalize)
    curve.NormalizedLengthParameter(start, out t0);
    curve.NormalizedLengthParameter(start + length, out t1);
    curve.LengthParameter(start, out t0);
    curve.LengthParameter(start + length, out t1);
  A = curve.Trim(t0, t1);

SubCurve.gh (4.4 KB)


Very elegant code, that’s what I’ll be using. Thank you!

// Rolf

Your code doesn’t behave the same as mine, regardless of ‘normalize’? It appears that ‘normalize’ is affecting ‘length’ instead of only ‘start’?

I think ‘length’ should not be affected by ‘normalize’:

subcurve_2020May21b.gh (11.2 KB)


subcurve_2020May21c.gh (12.0 KB)