How can I find the max and min "diameters" of an unregular shape (like a circle)? The min diameter should be penpendicular to max one

I thought you want the min / max diameter from the center ; it’s not what you want
and the idea is to draw points along the curve and measure the distance between them and the center

Thank you, Seghier, for your reply and kind help!

Hi Joseph,

Here just one extended request: if there are multiple curves, how should the code be modified (to create the results in a list)? I tried to use the tree structure, but failed :(.

Thanks in advance!!

Yeah, I figured you would get to that. How many curves? Because performance of my last version isn’t very good when you want the highest accuracy, and that probably needs to be improved if there are hundreds (thousands?) of curves.

Oh, and are they all on ‘World XY’ plane or do I need to determine the plane of each curve? I’m sure it’s the latter, of course?

I’ve done a little puttering on it but no break through yet. Will let you know. I wonder if doing each curve one at a time using Anemone is necessary?

Wow, Joseph, you are so kind!
Yes, you figured out everything I need like a detective :smile:. There are not so many curves, less than 30. And the plane of each curve needs to be determinded.
I don’t understand well what you mean “using Anemone”, but each curve needs to get the measurement.
Thanks again for your help!!
multiple-curves.3dm (102.8 KB)

Anemone might be used to loop through the curves one at a time, using the version ‘d’ code. Not ideal, perhaps but I’ve got other things to do.

I can’t read your R6 .3dm file, can you post an R5 version?

I took a different approach and got something working on four copies of the original curve but:

  • it’s slow when precision is maximized and
  • I forgot to identify the unique plane for each curve

Back to the drawing board…

Hi Joseph, here is the R5 version file. Please check if it is OK.

Thanks again!

multiple-curves-v5.3dm (101.0 KB)

This version takes less than a minute for your 26 curves as the sliders are set now. It will be more accurate if the values are increased, though can take much, much longer! As before, the white 'X’s are the area centroids for each curve, not used for anything.


max_min_2019Sep25a.gh (82.3 KB)

I’m sure the performance can be improved but not so sure I’m motivated to do so. For example, low precision slider settings can quickly approximate the max “diameter”, followed by a high res “search” in a narrow range around it. Or find a better algorithm, such as what I used before(?), but better has to be proven with benchmarks.

‘Crv Test 1’ and ‘Crv Test 2’ are copies of the same curve so in theory, all four curves should produce the same values for max/min. At the settings used in this file, they can be off by a few hundredths or thousandths.

The ‘Steps’ slider in particular has a dramatic effect on both precision (BETTER!) and speed (much slower). Try 360, for example, which creates parallel planes rotated every half degree.

1 Like

Hi Josephi, the code is perfect!
It seems that you used advanced contols of the tree structure. I should need a long time to fully understand it.
Thank you so much for your kind and patience!!