How to create a Region from a Location

Asked by Rainer

Is there a simple way to create a region from a location - a region that has the given location at its center?

Like the inverse of getCenter() where I can get the location of the center of a region?

Something like location.grow(num) which should give a quadratic region with the location as its center and side lenghts of num?

Of course one can do that with Region(Location.x - num//2, Location.y - num//2, num, num) or the like, I was just wondering whether there might be a "nicer", more direct way?

Thank you.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

sorry, not in the docs ;-)

quadratic: reg = someLoc.grow(size)

rectengular: reg = someLoc.grow(sizeWidth, sizeHeight)

Revision history for this message
Rainer (formulator) said :
#2

Thank you, RaiMan, I was quite close with my guesswork resp. suggestion … :)

Revision history for this message
Rainer (formulator) said :
#3

Thanks RaiMan, that solved my question.