diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-12 05:07:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-12 05:07:31 +0400 |
commit | 9cce2d864554cb78abfb5e2909dfb1a506933d3c (patch) | |
tree | 57f1037cb16ce26791f4bb1cd5fb0a88293d8af9 /source/blender/blenlib/intern/rct.c | |
parent | 1aaaf67a9e42cfbba6d8c955a9e0a7519b296933 (diff) |
smooth-view for 2d views, graph editor, sequencer, node view, works with border zoom, view selected, view all.
Diffstat (limited to 'source/blender/blenlib/intern/rct.c')
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 68a00d81444..e22becddfd6 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -270,6 +270,39 @@ void BLI_rctf_resize(rctf *rect, float x, float y) rect->ymax = rect->ymin + y; } +void BLI_rctf_interp(rctf *rect, const rctf *rect_a, const rctf *rect_b, const float fac) +{ + const float ifac = 1.0f - fac; + rect->xmin = (rect_a->xmin * ifac) + (rect_b->xmin * fac); + rect->xmax = (rect_a->xmax * ifac) + (rect_b->xmax * fac); + rect->ymin = (rect_a->ymin * ifac) + (rect_b->ymin * fac); + rect->ymax = (rect_a->ymax * ifac) + (rect_b->ymax * fac); +} + +/* BLI_rcti_interp() not needed yet */ + +int BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit) +{ + if (fabsf(rect_a->xmin - rect_b->xmin) < limit) + if (fabsf(rect_a->xmax - rect_b->xmax) < limit) + if (fabsf(rect_a->ymin - rect_b->ymin) < limit) + if (fabsf(rect_a->ymax - rect_b->ymax) < limit) + return 1; + + return 0; +} + +int BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b) +{ + if (rect_a->xmin == rect_b->xmin) + if (rect_a->xmax == rect_b->xmax) + if (rect_a->ymin == rect_b->ymin) + if (rect_a->ymax == rect_b->ymax) + return 1; + + return 0; +} + int BLI_rctf_isect(const rctf *src1, const rctf *src2, rctf *dest) { float xmin, xmax; |