How to separate rectangular surfaces from a bunch of surfaces?

Hi, there are some mixed shapes. How can I separate rectangular surfaces from the other ones?

Forum-CullingRectangles.gh (27.0 KB)

This seems to work for your “simple” geometry

My geometry is not “simple”. I just have shown a small part of the hole modell. Do you know a solution that does the sperating more geometrically? This way is just culling by distance and is not that precise.


CullingRectangles_2020Apr30a.gh (32.9 KB)

@Joseph_Oster Thank you, but it seams to me that there are some rectangular faces inside the non-rectangle group.

Green = rectangles
Blue = non rectangles

Simple was a way to say that there was just some basic shapes with no holes, curved part … that could lead to bad results.
For example I am sure my algorithm doesn’t wort with diamond as the one of Joseph.

Lets come back to math and measure angles between edges if all angles = 90° it must be a rectangle

@laurent_delrieu Thank you, you are right. Just planar nurbs. How could your idea look like includin the angle measurement? I think there should be the option of tollerances inside, because I do not think that all surfaces are perfectly 100 % rectangles

Yes, I noticed that. It’s because your rectangles are not precise, their edge lengths aren’t the same. Adding the expression “round(x,1)” to the Len output seems to fix that - but it’s dicey.


CullingRectangles_2020Apr30b.gh (32.9 KB)

Measuring angles will have the same problem when the geometry is sloppy.

let me quickly check for the hole model :wink:

Unfortunatetly I can not optimize the geo beacuse it was scanned by drone with lidar sensors

Okay, I think it is okay for most of the parts. Thanks again for your help.

check this, not the most elegant, but works here for all casesForum-CullingRectangles PS.gh (42.4 KB)

1 Like

:heart_eyes: Thank you @Piotr

You can change the expression to “round(x)” (to the nearest integer) and change Equals (2) to Smaller (than 3) to handle squares where there is only one length for all four sides.


CullingRectangles_2020Apr30c.gh (35.2 KB)

1 Like

Clever and quick, but comparing length in sets may result that rhombs are selected as well. Am I right or not?

missing

You can ignore it, it was just for cross-checking.

I’d like to ignore it but since I can’t see it, I don’t know how to wire around it?

You are right. Triangles too.

I’d love to see your solution?

It is attached to my post above.
I, basically, run bounding box plane through each surface and then measured the sum of distances from each control point to boundary of bounding box.
It equals zero only for rectangles, any other polygons are eliminated.