a4e0df2d62699cb4704e25c5a4cb26a2eee10771
[ipdf/code.git] / src / quadtree.cpp
1 #ifndef QUADTREE_REMOVED
2 #include "quadtree.h"
3
4 namespace IPDF {
5
6 Rect TransformToQuadChild(const Rect& src, QuadTreeNodeChildren child_type)
7 {
8         Rect dst;
9         dst.x *= 2;
10         dst.y *= 2;
11         dst.w *= 2;
12         dst.h *= 2;
13         if (child_type == QTC_BOTTOM_LEFT || child_type == QTC_BOTTOM_RIGHT)
14         {
15                 dst.x -= 2;
16         }
17         if (child_type == QTC_TOP_RIGHT || child_type == QTC_BOTTOM_RIGHT)
18         {
19                 dst.y -= 2;
20         }
21         return dst;
22 }
23
24 Rect TransformFromQuadChild(const Rect& src, QuadTreeNodeChildren child_type)
25 {
26         Rect dst;
27         dst.x *= 0.5;
28         dst.y *= 0.5;
29         dst.w *= 0.5;
30         dst.h *= 0.5;
31         if (child_type == QTC_BOTTOM_LEFT || child_type == QTC_BOTTOM_RIGHT)
32         {
33                 dst.x += 0.5;
34         }
35         if (child_type == QTC_TOP_RIGHT || child_type == QTC_BOTTOM_RIGHT)
36         {
37                 dst.y += 0.5;
38         }
39         return dst;
40 }
41
42 }
43
44 #endif

UCC git Repository :: git.ucc.asn.au