# GH function that determines height of geometry where it's the widest

So i do not have a file I am working on but I need to an answer to this question to know.
Imagine I have a plant geometry on rhino (let’s say a tree) and I connect this geometry to grasshopper.
Is there a function on grasshopper that determines for me at what height (z) the tree has the biggest width?

Hi -

There is no single component that will give you that answer, no. And the correct combination of components will likely depend on the specifics of both the input geometry and requirements of the output.

You could try to section the geometry at intervals and check the area of the sections.
-wim

I don’t know how elaborate your “plant” will be, but this gives a decent approximation.

Height at Widest.gh (10.9 KB)

I kind of created an idealized case here, and the more I think about it, the more I realize your question does not have a simple answer. I agree with @wim that it depends on your geometry, and also defining maximum width with respect to what? For example, are you looking for maximum distance from the axis of the stem?

Here’s something more general that looks at maximum distance from the bottom of the “stem”. It also doesn’t depend on being at the origin. If you play around with the slider, the more points you use, the more it will converge on one value, but its up to you how precise you want to be.

Height at Widest-b.gh (16.5 KB)

1 Like

This seems closely related to finding the minimum oriented bounding box.

Because it sounds like you are only interested in the horizontal width though, it’s slightly simpler - you could project the shape to a horizontal plane and take the minimum area oriented bounding rectangle. @Antonio_Cersosimo’s script here works well for this:

That’s for a polyline, but you could combine it with the Mesh.GetOutlines method like this:
Minimal Bounding Rectangle Python_projected.gh (4.8 KB)

-edit - I just read the question again and realised the script above doesn’t actually properly answer it, since you’d still need to get the height at which the widest point occurs. Perhaps you could do it by taking contours and then getting the minimum rectangles of these.

1 Like