How to find if a shape is concave or convex?

i have quite a lot of shapes, and i want to sort them into concave and convex shapes.

i came up with the solution but it is quite long and is taking up quite a lot of time to load. is there any better way to do it that takes up less memory and doesnt slow down everything (i have quite a lot of shapes)
(attached image of the script and the grasshopper file)

convex_concave.gh (23.2 KB)
so what i am doing is that i am making a circle at each vertex of every shape, them trimming the circle with the shape, then using the arc length to find the internal angle, then if there is an angle greater than 180 the shape is concave otherwise convex

i took a part of the current solution from HS-kim Angle in a polyline
(rhino6)

You can use convex component from box2d.

2 Likes

thanks for you help.

the first thing i did was to search for a component that does this, i dont know how i missed it .