7 #ifndef BALL_MATHS_BOX3_H
8 #define BALL_MATHS_BOX3_H
14 #ifndef BALL_MATHS_VECTOR3_H
91 void set(
const TBox3& box);
208 void dump(std::ostream& s = std::cout,
Size depth = 0)
const;
226 template <
typename T>
229 right_vector_(right_vector),
230 height_vector_(height_vector),
231 depth_vector_((right_vector % height_vector).normalize() * depth),
232 width_(right_vector.getLength()),
233 height_(height_vector.getLength()),
237 template <
typename T>
243 right_vector_(right_vector),
244 height_vector_(height_vector),
245 depth_vector_(depth_vector),
246 width_(right_vector.getLength()),
247 height_(height_vector.getLength()),
248 depth_(depth_vector.getLength())
251 template <
typename T>
253 : point_((T)0, (T)0, (T)0),
254 right_vector_((T)0, (T)1, (T)0),
255 height_vector_((T)1, (T)0, (T)0),
256 depth_vector_((T)0, (T)0, (T)1),
263 template <
typename T>
265 : point_(box.point_),
266 right_vector_(box.right_vector_),
267 height_vector_(box.height_vector_),
268 depth_vector_(box.depth_vector_),
270 height_(box.height_),
275 template <
typename T>
287 template <
typename T>
295 template <
typename T>
303 std::swap(width_, box.
width_);
304 std::swap(height_, box.
height_);
305 std::swap(depth_, box.
depth_);
308 template <
typename T>
321 template <
typename T>
325 right_vector_.normalize();
326 right_vector_ *= width;
330 template <
typename T>
334 height_vector_.normalize();
335 height_vector_ *= height;
339 template <
typename T>
343 depth_vector_.normalize();
344 depth_vector_ *= depth;
348 template <
typename T>
356 template <
typename T>
364 template <
typename T>
372 template <
typename T>
376 return ((width_ * height_ + width_ * depth_ + height_ * depth_) * 2);
379 template <
typename T>
382 return (right_vector_ + height_vector_ + depth_vector_);
385 template <
typename T>
389 return (width_ * height_ * depth_);
392 template <
typename T>
395 return (point_ == box.
point_ &&
404 template <
typename T>
408 return !(*
this == box);
411 template <
typename T>
415 return (point_.isValid() &&
416 right_vector_.isValid() &&
417 height_vector_.isValid() &&
418 depth_vector_.isValid() &&
419 !right_vector_.isZero() &&
420 !height_vector_.isZero() &&
421 !depth_vector_.isZero());
425 template <
typename T>
433 s <<
"point: " << point_ << std::endl;
436 s <<
"right_vector: " << right_vector_ << std::endl;
439 s <<
"height_vector: " << height_vector_ << std::endl;
442 s <<
"depth_vector: " << depth_vector_ << std::endl;
445 s <<
"width: " << width_ << std::endl;
448 s <<
"height: " << height_ << std::endl;
451 s <<
"depth: " << depth_ << std::endl;
463 template <
typename T>
467 s >> point >> right >> height >> depth;
483 template <
typename T>
484 std::ostream& operator << (std::ostream& s, const TBox3<T>& box)
486 return s << box.getPoint() <<
" "
487 << box.getRightVector() <<
" "
488 << box.getHeightVector() <<
" "
489 << box.getDepthVector();
500 #endif // BALL_MATHS_BOX3_H