3
$\begingroup$

I'm trying to measure the total length of a complex curve with a large number of points.

My initial input is a set of curves from an imported dxf file. I selected the section I wanted to measure and transformed it into a mesh to be able to use the MeasureIt plugin. I followed the guidance from a question posted earlier, but when I tried using the MeasureIt plugin, it only measured a portion of the curve.

I assume that the section I'm trying to measure has more segments than MeasureIt can handle(over 2000 selected). Is there an alternative approach to try, or some settings that would allow more segments to be summed in MeasureIt?

I've linked the previous question and a picture below.

Total length of a complex curve

Selected points enter image description here

MeasureIt displaying only a portion of the segments enter image description here

$\endgroup$

1 Answer 1

5
$\begingroup$

You can use a Viewer node in Geometry Nodes to check the length of the curve if you plug in a node that measures the length. There are different options:

  • The best to get the overall length is using a Curve Length node.

  • If your object consists of several disconnected curves and you want the lengths separately, use a Spline Length node.

  • To get the length of the control points cumulating from start to end, you could also use the Length output of the Spline Parameter node. However this doesn't work for cyclic splines, since it never calculates the length from the last point back to the first point, so it misses one segment of the cyclic curve.

Here are some examples to show the different options. I used a mesh here which I convert with Mesh to Curve in Geometry Nodes, because you mentioned converting your curve, but of course it works with curve objects directly if you delete the Mesh to Curve node.

Curve Length: The simplest way to get the overall length of a curve object, no matter how many separate splines and if cyclic or not.

curve length

Spline Length: Shows the length of each spline if the curve consists of multiple separate splines.

spline length

Spline Parameter > Length: Shows the legth from the beginning to the current point in the row, disadvantage for measuring the length of an entire curve is it doesn't calculate the "way back" from the last point to the first.

spline parameter

$\endgroup$
4
  • 1
    $\begingroup$ I somehow didn't know about the Curve Length node! I learned something from this - thanks :) (Deleting my answer as your is much better!) $\endgroup$
    – SlickRed
    Sep 21, 2022 at 9:22
  • 1
    $\begingroup$ I made a test wondering if it's a fancy calculation of a mathematical length, or maybe an approximation but based on the curve's parameters, but no, it outputs a sum of lengths of the curve's segments given its resolution - which is alright, but I thought it's nice to know that: i.imgur.com/ebcfj5N.gif BTW, a formula for calculating the length of a quadratic bezier is already very long: gamedev.stackexchange.com/a/125321/15836 - a formula for cubic bezier is said to be impossible: en.wikipedia.org/wiki/Abel%E2%80%93Ruffini_theorem $\endgroup$ Sep 21, 2022 at 11:19
  • 1
    $\begingroup$ @MarkusvonBroady Yes, it's just a sum of the curve's segments. But since the original curve already seems to be a quite complex shade of many short segments I thought this would be okay for this kind of problem. $\endgroup$ Sep 21, 2022 at 11:40
  • $\begingroup$ Fantastic stuff! I'd seen references to using geometry nodes but hadn't seen any examples on how it was done. Being able to measure the curve directly instead of having to change it to a mesh saves a step as well which is always appreciated! $\endgroup$
    – Corey
    Sep 22, 2022 at 1:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .