| Reference | Downloads | Github

Set coordinates to corner of object, not centre

Hi All,

A very newbie question, but is it possible to specify coordinates in a way that work from the corner of the polygon/image, rather than from the centre? I’m currently trying to create a growing polygon that needs to be placed in relation to another image. (It’s actually a bar on a bar graph that I want to grow, and it would be easiest to be able to have one edge of the bar at an absolute position).

Please let me know if you think some code would help here, but in this case I think the description of the general issue might be enough

Thanks in advance

Yes, this is just simple geometry. e.g. if you want the corner of a bar to be fixed to the origin, just specify the location as being displaced by half the rectangle’s length and height.

Hi Michael,

Thanks, this is what I’m currently doing. We’re looking to teach UGs an experiment that involves this, and I thought it would have been a little neater to just increase height rather than have to increase the height and move the position by half the height.

Appreciate the reply


Yes, this is a case where a system can only usefully provide one built-in option (in this case, specifying the centre location), as there are so many ways in which a user might want to position arbitrary polygonal shapes. Without even considering that rectangles are just one sort of polygon, even for a bar graph, there are many alternatives (is it oriented vertically or horizontally, are the bars anchored by the centre of their baselines or by a corner (and if so, which corner), how are negative values handled, etc).