@@ -9,40 +9,16 @@ namespace std::experimental::io2d {
99 float _Width = 0 .0F ;
1010 float _Height = 0 .0F ;
1111 public:
12- constexpr bounding_box () noexcept { }
13- constexpr bounding_box (float x, float y, float width, float height) noexcept
14- : _X(x)
15- , _Y(y)
16- , _Width(width)
17- , _Height(height) {
18- }
19- constexpr bounding_box (const point_2d& tl, const point_2d& br) noexcept
20- : _X(tl.x)
21- , _Y(tl.y)
22- , _Width(::std::max(0 .0F , br.x - tl.x))
23- , _Height(::std::max(0 .0F , br.y - tl.y)) {
24- }
12+ constexpr bounding_box () noexcept ;
13+ constexpr bounding_box (float x, float y, float width, float height) noexcept ;
14+ constexpr bounding_box (const point_2d& tl, const point_2d& br) noexcept ;
2515
26- constexpr void x (float value) noexcept {
27- _X = value;
28- }
29- constexpr void y (float value) noexcept {
30- _Y = value;
31- }
32- constexpr void width (float value) noexcept {
33- _Width = value;
34- }
35- constexpr void height (float value) noexcept {
36- _Height = value;
37- }
38- constexpr void top_left (const point_2d& value) noexcept {
39- _X = value.x ;
40- _Y = value.y ;
41- }
42- constexpr void bottom_right (const point_2d& value) noexcept {
43- _Width = max (0 .0F , value.x - _X);
44- _Height = max (0 .0F , value.y - _Y);
45- }
16+ constexpr void x (float value) noexcept ;
17+ constexpr void y (float value) noexcept ;
18+ constexpr void width (float value) noexcept ;
19+ constexpr void height (float value) noexcept ;
20+ constexpr void top_left (const point_2d& value) noexcept ;
21+ constexpr void bottom_right (const point_2d& value) noexcept ;
4622
4723 constexpr float x () const noexcept ;
4824 constexpr float y () const noexcept ;
@@ -58,89 +34,26 @@ namespace std::experimental::io2d {
5834 friend constexpr bool operator ==(const bounding_box& lhs, const bounding_box& rhs) noexcept ;
5935 };
6036
61- inline constexpr float bounding_box::x () const noexcept {
62- return _X;
63- }
64-
65- inline constexpr float bounding_box::y () const noexcept {
66- return _Y;
67- }
68-
69- inline constexpr float bounding_box::width () const noexcept {
70- return _Width;
71- }
72-
73- inline constexpr float bounding_box::height () const noexcept {
74- return _Height;
75- }
76-
77- inline constexpr float bounding_box::left () const noexcept {
78- return _X;
79- }
80-
81- inline constexpr float bounding_box::right () const noexcept {
82- return _X + _Width;
83- }
84-
85- inline constexpr float bounding_box::top () const noexcept {
86- return _Y;
87- }
88-
89- inline constexpr float bounding_box::bottom () const noexcept {
90- return _Y + _Height;
91- }
92-
93- inline constexpr point_2d bounding_box::top_left () const noexcept {
94- return { _X, _Y };
95- }
96-
97- inline constexpr point_2d bounding_box::bottom_right () const noexcept {
98- return { _X + _Width, _Y + _Height };
99- }
100-
101- class circle {
37+ constexpr bool operator ==(const bounding_box& lhs, const bounding_box& rhs) noexcept ;
38+ constexpr bool operator !=(const bounding_box& lhs, const bounding_box& rhs) noexcept ;
39+
40+ class circle {
10241 point_2d _Center;
10342 float _Radius;
10443 public:
105- constexpr circle () noexcept
106- : _Center()
107- , _Radius() {}
108- constexpr circle (const point_2d& ctr, float r) noexcept
109- : _Center(ctr)
110- , _Radius(r) {}
44+ constexpr circle () noexcept ;
45+ constexpr circle (const point_2d& ctr, float r) noexcept ;
11146
112- constexpr void center (const point_2d& ctr) noexcept {
113- _Center = ctr;
114- }
115- constexpr void radius (float r) noexcept {
116- _Radius = r;
117- }
47+ constexpr void center (const point_2d& ctr) noexcept ;
48+ constexpr void radius (float r) noexcept ;
11849
119- constexpr point_2d center () const noexcept {
120- return _Center;
121- }
122- constexpr float radius () const noexcept {
123- return _Radius;
124- }
50+ constexpr point_2d center () const noexcept ;
51+ constexpr float radius () const noexcept ;
12552
126- constexpr bool operator ==(const circle& rhs) noexcept {
127- return _Center == rhs._Center && _Radius == rhs._Radius ;
128- }
129- constexpr bool operator !=(const circle& rhs) noexcept {
130- return !((*this ) == rhs);
131- }
53+ constexpr bool operator ==(const circle& rhs) noexcept ;
54+ constexpr bool operator !=(const circle& rhs) noexcept ;
13255 };
13356
134- class bounding_box ;
135- constexpr bool operator ==(const bounding_box& lhs, const bounding_box& rhs)
136- noexcept {
137- return lhs._X == rhs._X && lhs._Y == rhs._Y && lhs._Width == rhs._Width && lhs._Height == rhs._Height ;
138- }
139- constexpr bool operator !=(const bounding_box& lhs, const bounding_box& rhs)
140- noexcept {
141- return !(lhs == rhs);
142- }
143- class circle ;
14457 constexpr bool operator ==(const circle& lhs, const circle& rhs) noexcept ;
14558 constexpr bool operator !=(const circle& lhs, const circle& rhs) noexcept ;
14659
0 commit comments