Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 865 vs 993 for /trunk/Source Code/Core/Math/BoundingVolumes/Headers/BoundingBox.inl

Diff revisions: vs.
  @@ -40,9 +40,10 @@
40 40 IS_LEQUAL(point.x, _max.x) && IS_LEQUAL(point.y, _max.y) && IS_LEQUAL(point.z, _max.z));
41 41 }
42 42
43 - inline bool BoundingBox::compare(const BoundingBox& bb) const {
43 + inline bool BoundingBox::compare(const BoundingBox& bb) const noexcept {
44 44 /*ReadLock r_lock(_lock);*/
45 - return _GUID == bb._GUID;
45 + return _min == bb._min &&
46 + _max == bb._max;
46 47 }
47 48
48 49 inline bool BoundingBox::operator==(const BoundingBox& B) const {
  @@ -54,7 +55,7 @@
54 55 }
55 56
56 57 inline void BoundingBox::createFromPoints(const vectorImpl<vec3<F32>>& points) {
57 - for (vec3<F32> p : points) {
58 + for (const vec3<F32>& p : points) {
58 59 add(p);
59 60 }
60 61 }
  @@ -64,7 +65,7 @@
64 65 _min.set(center - radius);
65 66 }
66 67
67 - inline void BoundingBox::add(const vec3<F32>& v) {
68 + inline void BoundingBox::add(const vec3<F32>& v) noexcept {
68 69 // WriteLock w_lock(_lock);
69 70 if (v.x > _max.x) {
70 71 _max.x = v.x;
  @@ -86,7 +87,7 @@
86 87 }
87 88 };
88 89
89 - inline void BoundingBox::add(const BoundingBox& bb) {
90 + inline void BoundingBox::add(const BoundingBox& bb) noexcept {
90 91 // WriteLock w_lock(_lock);
91 92 _max.set(std::max(bb._max.x, _max.x),
92 93 std::max(bb._max.y, _max.y),
  @@ -97,19 +98,19 @@
97 98 std::min(bb._min.z, _min.z));
98 99 }
99 100
100 - inline void BoundingBox::translate(const vec3<F32>& v) {
101 + inline void BoundingBox::translate(const vec3<F32>& v) noexcept {
101 102 // WriteLock w_lock(_lock);
102 103 _min += v;
103 104 _max += v;
104 105 }
105 106
106 - inline void BoundingBox::multiply(F32 factor) {
107 + inline void BoundingBox::multiply(F32 factor) noexcept {
107 108 // WriteLock w_lock(_lock);
108 109 _min *= factor;
109 110 _max *= factor;
110 111 }
111 112
112 - inline void BoundingBox::multiply(const vec3<F32>& v) {
113 + inline void BoundingBox::multiply(const vec3<F32>& v) noexcept {
113 114 // WriteLock w_lock(_lock);
114 115 _min.x *= v.x;
115 116 _min.y *= v.y;
  @@ -119,111 +120,111 @@
119 120 _max.z *= v.z;
120 121 }
121 122
122 - inline void BoundingBox::multiplyMax(const vec3<F32>& v) {
123 + inline void BoundingBox::multiplyMax(const vec3<F32>& v) noexcept {
123 124 // WriteLock w_lock(_lock);
124 125 _max.x *= v.x;
125 126 _max.y *= v.y;
126 127 _max.z *= v.z;
127 128 }
128 129
129 - inline void BoundingBox::multiplyMin(const vec3<F32>& v) {
130 + inline void BoundingBox::multiplyMin(const vec3<F32>& v) noexcept {
130 131 // WriteLock w_lock(_lock);
131 132 _min.x *= v.x;
132 133 _min.y *= v.y;
133 134 _min.z *= v.z;
134 135 }
135 136
136 - inline const vec3<F32>& BoundingBox::getMin() const {
137 + inline const vec3<F32>& BoundingBox::getMin() const noexcept {
137 138 /*ReadLock r_lock(_lock);*/
138 139 return _min;
139 140 }
140 141
141 - inline const vec3<F32>& BoundingBox::getMax() const {
142 + inline const vec3<F32>& BoundingBox::getMax() const noexcept {
142 143 /*ReadLock r_lock(_lock);*/
143 144 return _max;
144 145 }
145 146
146 - inline vec3<F32> BoundingBox::getCenter() const {
147 + inline vec3<F32> BoundingBox::getCenter() const noexcept {
147 148 /*ReadLock r_lock(_lock);*/
148 149 return (_max + _min) * 0.5f;
149 150 }
150 151
151 - inline vec3<F32> BoundingBox::getExtent() const {
152 + inline vec3<F32> BoundingBox::getExtent() const noexcept {
152 153 /*ReadLock r_lock(_lock);*/
153 154 return _max - _min;
154 155 }
155 156
156 - inline vec3<F32> BoundingBox::getHalfExtent() const {
157 + inline vec3<F32> BoundingBox::getHalfExtent() const noexcept {
157 158 /*ReadLock r_lock(_lock);*/
158 159 return (_max - _min) * 0.5f;
159 160 }
160 161
161 - inline F32 BoundingBox::getWidth() const {
162 + inline F32 BoundingBox::getWidth() const noexcept {
162 163 /*ReadLock r_lock(_lock);*/
163 164 return _max.x - _min.x;
164 165 }
165 166
166 - inline F32 BoundingBox::getHeight() const {
167 + inline F32 BoundingBox::getHeight() const noexcept {
167 168 /*ReadLock r_lock(_lock);*/
168 169 return _max.y - _min.y;
169 170 }
170 171
171 - inline F32 BoundingBox::getDepth() const {
172 + inline F32 BoundingBox::getDepth() const noexcept {
172 173 /*ReadLock r_lock(_lock);*/
173 174 return _max.z - _min.z;
174 175 }
175 176
176 - inline void BoundingBox::setMin(const vec3<F32>& min) {
177 + inline void BoundingBox::setMin(const vec3<F32>& min) noexcept {
177 178 setMin(min.x, min.y, min.z);
178 179 }
179 180
180 - inline void BoundingBox::setMax(const vec3<F32>& max) {
181 + inline void BoundingBox::setMax(const vec3<F32>& max) noexcept {
181 182 setMax(max.x, max.y, max.z);
182 183 }
183 184
184 - inline void BoundingBox::set(const BoundingBox& bb) {
185 + inline void BoundingBox::set(const BoundingBox& bb) noexcept {
185 186 set(bb._min, bb._max);
186 187 }
187 188
188 - inline void BoundingBox::set(F32 min, F32 max) {
189 + inline void BoundingBox::set(F32 min, F32 max) noexcept {
189 190 _min.set(min);
190 191 _max.set(max);
191 192 }
192 193
193 - inline void BoundingBox::set(F32 minX, F32 minY, F32 minZ, F32 maxX, F32 maxY, F32 maxZ) {
194 + inline void BoundingBox::set(F32 minX, F32 minY, F32 minZ, F32 maxX, F32 maxY, F32 maxZ) noexcept {
194 195 _min.set(minX, minY, minZ);
195 196 _max.set(maxX, maxY, maxZ);
196 197 }
197 198
198 - inline void BoundingBox::setMin(F32 min) {
199 + inline void BoundingBox::setMin(F32 min) noexcept {
199 200 _min.set(min);
200 201 }
201 202
202 - inline void BoundingBox::setMin(F32 minX, F32 minY, F32 minZ) {
203 + inline void BoundingBox::setMin(F32 minX, F32 minY, F32 minZ) noexcept {
203 204 _min.set(minX, minY, minZ);
204 205 }
205 206
206 - inline void BoundingBox::setMax(F32 max) {
207 + inline void BoundingBox::setMax(F32 max) noexcept {
207 208 _max.set(max);
208 209 }
209 210
210 - inline void BoundingBox::setMax(F32 maxX, F32 maxY, F32 maxZ) {
211 + inline void BoundingBox::setMax(F32 maxX, F32 maxY, F32 maxZ) noexcept {
211 212 _max.set(maxX, maxY, maxZ);
212 213 }
213 214
214 - inline void BoundingBox::set(const vec3<F32>& min, const vec3<F32>& max) {
215 + inline void BoundingBox::set(const vec3<F32>& min, const vec3<F32>& max) noexcept {
215 216 /*WriteLock w_lock(_lock);*/
216 217 _min = min;
217 218 _max = max;
218 219 }
219 220
220 - inline void BoundingBox::reset() {
221 + inline void BoundingBox::reset() noexcept {
221 222 /*WriteLock w_lock(_lock);*/
222 223 _min.set( std::numeric_limits<F32>::max());
223 224 _max.set(-std::numeric_limits<F32>::max());
224 225 }
225 226
226 - inline std::array<vec3<F32>, 8> BoundingBox::getPoints() const {
227 + inline std::array<vec3<F32>, 8> BoundingBox::getPoints() const noexcept {
227 228 return std::array<vec3<F32>, 8>
228 229 {
229 230 (_min.x, _min.y, _min.z),