acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_defer_bounding_box.h
1#pragma once
2
3//
4//#include "arc.h"
5//#include "line.h"
6
7
8
9
10//template < prototype_rectangle RECTANGLE, prototype_number NUMBER >
11//inline bool expand_bounding_box(RECTANGLE & rectangleBounding, const ::arc_type < NUMBER > & arc)
12//{
13//
14// rectangleBounding.left = (decltype(rectangleBounding.left)) (arc.m_pointCenter.x - arc.m_sizeRadius.cx);
15// rectangleBounding.right = (decltype(rectangleBounding.right))(arc.m_pointCenter.x + arc.m_sizeRadius.cx);
16// rectangleBounding.top = (decltype(rectangleBounding.top))(arc.m_pointCenter.y - arc.m_sizeRadius.cy);
17// rectangleBounding.bottom = (decltype(rectangleBounding.bottom))(arc.m_pointCenter.y + arc.m_sizeRadius.cy);
18//
19// return true;
20//
21//}
22
23
24//template < prototype_rectangle RECTANGLE >
25//inline void expand_bounding_box(RECTANGLE & rectangle, ::f64_point * p, ::collection::count c)
26//{
27//
28// for (::collection::index i = 0; i < c; i++)
29// {
30//
31// expand_bounding_box(rectangle, *p);
32//
33// p++;
34//
35// }
36//
37//}
38
39
40
41//inline bool get_bounding_box(::f64_rectangle * prectangleBounding, const ::arc * parc)
42//{
43//
44// rectangleBounding.left = arc.m_pointCenter.x - arc.m_sizeRadius.cx;
45// rectangleBounding.right = arc.m_pointCenter.x + arc.m_sizeRadius.cx;
46// rectangleBounding.top = arc.m_pointCenter.y - arc.m_sizeRadius.cy;
47// rectangleBounding.bottom = arc.m_pointCenter.y + arc.m_sizeRadius.cy;
48//
49// return true;
50//
51//}
52
53
54
55//inline bool get_bounding_box(::f64_rectangle* prectangleBounding, const line* pline)
56//{
57//
58// rectangleBounding.left = minimum(line.m_p1.x, line.m_p2.x);
59// rectangleBounding.top = minimum(line.m_p1.y, line.m_p2.y);
60// rectangleBounding.right = maximum(line.m_p1.x, line.m_p2.x);
61// rectangleBounding.bottom = maximum(line.m_p1.y, line.m_p2.y);
62//
63// return true;
64//
65//}
66
67
68//inline bool get_bounding_box(::i32_rectangle* prectangleBounding, const line * pline)
69//{
70//
71// rectangleBounding.left = (::i32)minimum(line.m_p1.x, line.m_p2.x);
72// rectangleBounding.top = (::i32)minimum(line.m_p1.y, line.m_p2.y);
73// rectangleBounding.right = (::i32)maximum(line.m_p1.x, line.m_p2.x);
74// rectangleBounding.bottom = (::i32)maximum(line.m_p1.y, line.m_p2.y);
75//
76// return true;
77//
78//}
79
80
81//inline bool get_bounding_box(::f64_rectangle* prectangleBounding, const line * pline)
82//{
83//
84// rectangleBounding.left = minimum(line.m_p1.x, line.m_p2.x);
85// rectangleBounding.top = minimum(line.m_p1.y, line.m_p2.y);
86// rectangleBounding.right = maximum(line.m_p1.x, line.m_p2.x);
87// rectangleBounding.bottom = maximum(line.m_p1.y, line.m_p2.y);
88//
89// return true;
90//
91//}
92
93//
94//template < prototype_rectangle RECTANGLE, prototype_number NUMBER >
95//inline bool get_bounding_box(RECTANGLE & rectangleBounding, const ellipse_base < NUMBER > & ellipse)
96//{
97//
98// copy(rectangleBounding, ellipse);
99//
100// return true;
101//
102//}
103
104
105//inline bool get_bounding_box(::f64_rectangle* prectangleBounding, const ellipse * pellipse)
106//{
107//
108// copy(prectangleBounding, pellipse);
109//
110// return true;
111//
112//}
113
114
115//inline bool get_bounding_box(::i32_rectangle* prectangleBounding, const ellipse* poval)
116//{
117//
118// copy(prectangleBounding, poval);
119//
120// return true;
121//
122//}
123
124
125//inline bool get_bounding_box(::f64_rectangle* prectangleBounding, const ellipse* prectangle)
126//{
127//
128// copy(prectangleBounding, prectangle);
129//
130// return true;
131//
132//}
133//
134//
135
136
137//template < prototype_rectangle RECTANGLE1, prototype_rectangle RECTANGLE2 >
138//inline bool get_bounding_box(RECTANGLE1 & rectangleBounding, const RECTANGLE2 & rectangle)
139//{
140//
141// copy(rectangleBounding, rectangle);
142//
143// return true;
144//
145//}
146
147//
148//template < prototype_number NUMBER1, prototype_number NUMBER2 >
149//void expand_bounding_box(::rectangle_type < NUMBER1 > & rectangle, ::point_type < NUMBER2 > & point)
150//{
151//
152// if (point.x < (NUMBER1) rectangle.left)
153// {
154//
155// rectangle.left = (NUMBER1) point.x;
156//
157// }
158// else if (pointVertex.x > (NUMBER1) rectangle.right)
159// {
160//
161// rectangle.right = (NUMBER1) point.x;
162//
163// }
164//
165// if (point.y < (NUMBER1)rectangle.top)
166// {
167//
168// rectangle.top = (NUMBER1)point.y;
169//
170// }
171// else if (point.y > (NUMBER1) rectangle.bottom)
172// {
173//
174// rectangle.bottom = (NUMBER1)point.y;
175//
176// }
177//
178//}
179
180//
181//template < prototype_number NUMBER1, prototype_number NUMBER2 >
182//inline void expand_bounding_box_x(::rectangle_type < NUMBER1 > & rectangle, NUMBER2 x)
183//{
184//
185// if ((NUMBER1) x < rectangle.left)
186// {
187//
188// rectangle.left = (NUMBER1)x;
189//
190// }
191// else if ((NUMBER1) x > rectangle.right)
192// {
193//
194// rectangle.right = (NUMBER1)x;
195//
196// }
197//
198//}
199//
200//
201//template < prototype_number NUMBER1, prototype_number NUMBER2 >
202//inline void expand_bounding_box_y(::rectangle_type < NUMBER1 > & rectangle, NUMBER2 y)
203//{
204//
205// if ((NUMBER1)y < rectangle.top)
206// {
207//
208// rectangle.top = (NUMBER1)y;
209//
210// }
211// else if ((NUMBER1)y > rectangle.bottom)
212// {
213//
214// rectangle.bottom = (NUMBER1)y;
215//
216// }
217//
218//}
219//
220//
221//template < prototype_number NUMBER1, prototype_number NUMBER2 >
222//void expand_bounding_box(::rectangle_type < NUMBER1 > & rectangle, const ::point_type < NUMBER2 > & point)
223//{
224//
225// expand_bounding_box_x(rectangle, point.x);
226//
227// expand_bounding_box_y(rectangle, point.y);
228//
229//}
230//
231//
232//template < prototype_number NUMBER1, prototype_number NUMBER2 >
233//void expand_bounding_box(::rectangle_type < NUMBER1 > & rectangle, const ::rectangle_type < NUMBER2 > & rectangle2)
234//{
235//
236// expand_bounding_box_x(rectangle, rectangle2.left);
237//
238// expand_bounding_box_y(rectangle, rectangle2.top);
239//
240// expand_bounding_box_x(rectangle, rectangle2.right);
241//
242// expand_bounding_box_y(rectangle, rectangle2.bottom);
243//
244//}
245//
246//
247//template < prototype_number NUMBER1, prototype_number NUMBER2 >
248//void expand_bounding_box(::rectangle_type < NUMBER1 > & rectangle, const ::ellipse_type < NUMBER2 > & ellipse2)
249//{
250//
251// expand_bounding_box_x(rectangle, ellipse2.left);
252//
253// expand_bounding_box_y(rectangle, ellipse2.top);
254//
255// expand_bounding_box_x(rectangle, ellipse2.right);
256//
257// expand_bounding_box_y(rectangle, ellipse2.bottom);
258//
259//}
260//
261
262
263
264
265//template < prototype_rectangle RECTANGLE, prototype_number NUMBER >
266//inline void expand_bounding_box(RECTANGLE & rectangleBounding, const ::line_type < NUMBER > & line)
267//{
268//
269// expand_bounding_box(rectangleBounding, line.m_p1);
270// expand_bounding_box(rectangleBounding, line.m_p2);
271//
272//}
273
274
275
276template < prototype_rectangle RECTANGLE, typename TYPE >
277inline bool get_bounding_box(RECTANGLE & rectangleBounding, const TYPE & t)
278{
279
280 rectangleBounding.maximum_minimum();
281
282 t.expand_bounding_box(rectangleBounding.top_left(), rectangleBounding.bottom_right());
283
284 //rectangleBounding.left = (decltype(rectangleBounding.left))minimum(line.m_p1.x, line.m_p2.x);
285 //rectangleBounding.top = (decltype(rectangleBounding.top))minimum(line.m_p1.y, line.m_p2.y);
286 //rectangleBounding.right = (decltype(rectangleBounding.right))maximum(line.m_p1.x, line.m_p2.x);
287 //rectangleBounding.bottom = (decltype(rectangleBounding.bottom))maximum(line.m_p1.y, line.m_p2.y);
288
289 return rectangleBounding.is_set();
290
291}
292
293
294template < prototype_rectangle RECTANGLE, prototype_point POINT >
295inline bool get_bounding_box(RECTANGLE & rectangleBounding, const POINT * ppoint, ::collection::count iPointCount)
296{
297
298 rectangleBounding.maximum_minimum();
299
300 POINT::expand_bounding_box(rectangleBounding.top_left(), rectangleBounding.bottom_right(), ppoint, iPointCount);
301
302 //rectangleBounding.left = (decltype(rectangleBounding.left))minimum(line.m_p1.x, line.m_p2.x);
303 //rectangleBounding.top = (decltype(rectangleBounding.top))minimum(line.m_p1.y, line.m_p2.y);
304 //rectangleBounding.right = (decltype(rectangleBounding.right))maximum(line.m_p1.x, line.m_p2.x);
305 //rectangleBounding.bottom = (decltype(rectangleBounding.bottom))maximum(line.m_p1.y, line.m_p2.y);
306
307 return rectangleBounding.is_set();
308
309}
310
311
312