Centerpoint outside of surface boundary


I was stuck for quite a while on getting a point inside a 2D surface that has a weird shape, like U-shape or with holes. I was looking for a reliable GH way of doing this on the internet, but couldn’t find it. Thanks to an explanation here I was able to create a solution in GH. Thought it would be nice to post this, in case other people get stuck. (12.0 KB)


Unless the Bounding Box is oriented to the surface, which it is not in this case, the method is somewhat arbitrary. You can see this by rotating the surface. The white point moves all over the place. (15.5 KB)

By the way, instead of creating a point at ‘0.5, 0.5’, you can use a text panel as shown.

Adding the purple group orients the Bounding Box to the surface’s longest edge which stabilizes the white point’s location, regardless of rotation. (18.6 KB)

Thank you for your contribution @Joseph_Oster.

For me, the purpose of the function is to find a point with the topological relationship A inside B. The script does exactly that regardless of the orientation of the bounding box or the shape of the surface. When changing the orientation it’ll still maintain that relationship. I don’t neccesarily see the added benefit of aligning the bbox to the surface’s longest edge when the location of the point itself is somewhat irrelevant.

“0.5, 0.5” or “// 0.5, 0.5” == “tomato” or “tomato”

So consistency and readability are not important? :man_facepalming: