diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-03-05 12:51:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-03-05 12:51:23 +0300 |
commit | 4a4d71414e7f4604d5e0146cc362068dddb71be5 (patch) | |
tree | a27ad058f753617dc965ba58f2bacb93f58644d1 /source/blender/blenlib/intern/rct.c | |
parent | 2089a17f7e69bb2106950b041486e23928065fb0 (diff) |
BLI_rect: add init from point functions
Initialize a rectangle from point+size.
Diffstat (limited to 'source/blender/blenlib/intern/rct.c')
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index ac73a981b45..e01a4714131 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -351,6 +351,22 @@ void BLI_rcti_init(rcti *rect, int xmin, int xmax, int ymin, int ymax) } } +void BLI_rctf_init_pt_size(rctf *rect, const float xy[2], float size) +{ + rect->xmin = xy[0] - size; + rect->xmax = xy[0] + size; + rect->ymin = xy[1] - size; + rect->ymax = xy[1] + size; +} + +void BLI_rcti_init_pt_size(rcti *rect, const int xy[2], int size) +{ + rect->xmin = xy[0] - size; + rect->xmax = xy[0] + size; + rect->ymin = xy[1] - size; + rect->ymax = xy[1] + size; +} + void BLI_rcti_init_minmax(rcti *rect) { rect->xmin = rect->ymin = INT_MAX; |