API: get center of Rectangle

I was wondering whether there is an option in the scripting api to get the center coordinates of a rectangle.

This is not a simple matter of x + width / 2, because the rectabgle can be rotated and in that case the x coordinate will be the actual coordinate of the “top left” corner, which is rotated.

If there is such a function, I’d like to know about it. If not, I wonder if some who could provide the trigonometry required to get from a topleft corner and an angle to the center coordinate of the rectangle

I found the answer in this old post: DEER need for X and Y to be the center of the object instead of top left corner - #2 by bjorn

1 Like