Extract the longest and shortest length of a geometry

Hi everybody,
I want to extract the longest and the shortest length of a geomtery, when it’s a rectangle they coincides with the length ansd the width of the geometry, but when it’s like the two others how can i proceed? I try but i want to verify if it’s true or not.
the second point that i strarted but i didn’t finish is how to establish the quotient L/l ( L is the longest segment inside the geometry, and l is the shortest one)

Larger and shorter.gh (7.6 KB)

You can try this, it should work for any planar geometry.

Larger and shorter.gh (8.3 KB)

1 Like

Not sure what your definition of shortest / longest length is, but for a more irregular geometry I guess you would need something like an oriented bounding box ?!

thank you I think it works. I want to extract the Quotient:

  1. L/l >=3.5
  2. <L/l<=3.5
  3. L/l >=2

There is a “And Gate” component which lets you test if several conditions are all true - is this what you are looking for?

But if the problem you are trying to solve is simply “Detect if this shape is a rectangle”, there may be better ways to do it…

Do you want to filter your input shapes according to these 3 criteria ? or create 3 lists of all quotient values for each criteria ? Or maybe something else ?

I want to separate the three lists because in every case the 3 D shape ( that I’m doing later) is different .
For example if L/l >=3.5 then the 3d shape is a barrel vault ( I did the the barrel vault, but i need to connect if with the hole programme) :slight_smile:

Ok, so try this :

You will have to adapt the test criterias to your real need.

I have changed the start of the workflow to handle 3D geometries (using BoundingBox instead of PlaneThroughShape). But the quotient is computed only on x and y dimensions.

It outputs 3 lists of shapes :

  1. Q >= 3.5
  2. 2 <= Q < 3.5
  3. Q < 2

I chose to color them, but you can do whatever you want instead.
Larger and shorter.gh (15 KB)

1 Like

thank you , how can I use the shortest and the longest segment as a cuve not just a number, to use each one later in the construction of the vault.? i tried line SLD but it doesn’t work…

SLD Component is used to build a line when you have a Start point, a Length and a Direction. If you find a way to extract these datas, you’ll have a straight line.

You’re first question was to extract dimensions of you’re shapes. If now you need to extract a subcurve of the shape, the logic must be adapted, because the workflow wasn’t using subcurves but the complete shape itself.

My inputs are polylines :

  • Explode Component to extract subcurves
  • Length Component to measure curve’s length
  • Sort List Component to sort subcurves by their length
  • List Item Component to extract first and last item of the sorted list (longest and shortest Subcurves).
    Larger and shorter.gh (13.1 KB)

I thought you were maybe asking for these curves :

I used SDL Component to give you an example.
Larger and shorter.gh (16.5 KB)

Thank you but I know those steps, and they are valid only when the curve is a rectangle.
my purpose is to find the longest and the largest segment of a curve and to mesure the dimension of each one of them.

That’s not true. If you look at the definition, it can handle any type of curve.

I think that you could find what you want in the length component. I suggest you take a panel component to see what’s excatly output of each Component. Then, it’s your job to find the better way of using them by composing with every GH tools.

1 Like

I tested it and it works very well, I’m sorry for the previous reply ^^