Verify a quadrilateral

Hi everyone,
I want to verify if a quadrilateral is a rectangle or not.
I thought may be about the angles ( if one of them is different from 0.5*Pi )
Thank you
rectangle

Probably a million ways to do this; here is but one. BTW, I didn’t use Equal to test for equality of areas because of floating point errors, a common complaint on this forum.


is rectangle.gh (9.9 KB)

1 Like

I think the first thing you need to check is if it’s planar or not.

thank you it works correctly

It will not work in some special cases…

is rectangle_2.gh (11.9 KB)

" Nothing will ever be attempted if all possible objections must first be overcome." - Samuel Johnson

I assumed that @Maya_Lily knew what kind of shapes she was working with, but here’s something to address the degenerate quad case.


is rectangle_3.gh (12.0 KB)

In general case, an arbitrary curve is rectangle if:

  • is closed curve
  • is planar curve
  • is polyline
  • all angles at discontinuity equal to Pi/2

Is_Rectangle_v1.gh (20.2 KB)

my question was just for quadrilaterals, but I have more shapes (rectangle, rectangle+arc, rectangle+2 arcs, segment++arc, cercle, ellipse and “other”)
Like in the file below

base_identification
base_identification.gh (16.6 KB)

some basic type of curves…

CurveType_v2.gh (7.6 KB)

it’s ok for circle and elipse. But for unknown i want to identify them more in my case i Have : “rectangle”, “segment+arc”; “rectangle+arc”; “rectangle+2 arcs” and “other”
So in total I have 7 types

Why didn’t you asked for this in the beginning? People could save time if you can’t even need their solutions to your initial question.

I said that the solution of @akilli is ok for me and I thank him a lot for that :slight_smile: , so I added his solution to my original work… but when people continue trying, I mentioned that my purpose is not to evaluate all the shapes in the world just the seven types related my work… I didn’t want to ask about everything to don’t think that I need someone to work in my place, it was just a question about somenthing specific that I can reshape according to my need… :slight_smile:
So I’m not loosing people their time, if it’s true I’m sorry @tim.stark

Forget it. My bad sorry! Didn’t read everything right.

1 Like