Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxBoundingBox Class Reference

Definition of a bounding box. More...

#include <HxBoundingBox.h>

List of all members.

Public Methods

 HxBoundingBox (HxPointZ b, HxPointZ e)
 Constructor, begin and end point are included. More...

 HxBoundingBox (HxSizes s)
 Constructor. More...

HxPointZ begin () const
 Begin point. More...

HxPointZ end () const
 End point. More...

HxSizes size () const
 Sizes. More...

bool isEmpty () const
 Check validity. More...

HxBoundingBox unite (const HxBoundingBox &arg) const
 Union of this and arg. More...

HxBoundingBox intersect (const HxBoundingBox &arg) const
 Intersection of this and arg. More...

HxBoundingBox extend (HxPointZ p) const
 Extension of the box. More...

HxBoundingBox translate (HxPointZ p) const
 Move the box. More...

bool includes (HxPointZ p) const
 Check whether p is in the box. More...

std::ostream & put (std::ostream &) const
 Put the box on the given stream. More...


Detailed Description

Definition of a bounding box.

Begin and end point are included in the box.


Constructor & Destructor Documentation

HxBoundingBox::HxBoundingBox HxPointZ    b,
HxPointZ    e
 

Constructor, begin and end point are included.

00014     : _isEmpty(false)
00015 {
00016     _begin = b.inf(e);
00017     _end = b.sup(e);
00018 }

HxBoundingBox::HxBoundingBox HxSizes    s
 

Constructor.

00021     : _isEmpty(false)
00022 {
00023     if (s.inf(HxSizes(1, 1, 1)) != HxSizes(1, 1, 1))
00024     {
00025         _isEmpty = true;
00026         s = HxSizes(0, 0, 0);
00027     }
00028     _begin = HxPointZ(0, 0, 0);
00029     _end = HxPointZ(s.x()-1, s.y()-1, s.z()-1);
00030 }


Member Function Documentation

HxPointZ HxBoundingBox::begin   const [inline]
 

Begin point.

00068 {
00069     return _begin;
00070 }

HxPointZ HxBoundingBox::end   const [inline]
 

End point.

00074 {
00075     return _end;
00076 }

HxSizes HxBoundingBox::size   const
 

Sizes.

00034 {
00035     HxPointZ s = _end - _begin + HxPointZ(1, 1, 1);
00036     return HxSizes(s.x(), s.y(), s.z());
00037 }

bool HxBoundingBox::isEmpty   const [inline]
 

Check validity.

00080 {
00081     return _isEmpty;
00082 }

HxBoundingBox HxBoundingBox::unite const HxBoundingBox &    arg const
 

Union of this and arg.

00041 {
00042     return HxBoundingBox(_begin.inf(arg._begin), _end.sup(arg._end));
00043 }

HxBoundingBox HxBoundingBox::intersect const HxBoundingBox &    arg const
 

Intersection of this and arg.

00047 {
00048     HxPointZ b = _begin.sup(arg._begin);
00049     HxPointZ e = _end.inf(arg._end);
00050     if (b.inf(e) == b)
00051         return HxBoundingBox(b, e);
00052     return HxBoundingBox(HxSizes(0, 0, 0));
00053 }

HxBoundingBox HxBoundingBox::extend HxPointZ    p const
 

Extension of the box.

00057 {
00058     return HxBoundingBox(_begin.inf(p), _end.sup(p));
00059 }

HxBoundingBox HxBoundingBox::translate HxPointZ    p const
 

Move the box.

00063 {
00064     return HxBoundingBox(_begin + p, _end + p);
00065 }

bool HxBoundingBox::includes HxPointZ    p const
 

Check whether p is in the box.

00069 {
00070     return (    (p.x() > _begin.x()) &&
00071                 (p.y() > _begin.y()) &&
00072                 (p.z() > _begin.z()) &&
00073                 (p.x() < _end.x()) &&
00074                 (p.y() < _end.y()) &&
00075                 (p.z() < _end.z()) ) ? true : false;
00076 }

std::ostream & HxBoundingBox::put std::ostream &    os const
 

Put the box on the given stream.

00080 {
00081     if (_isEmpty)
00082     {
00083         return os << "empty";
00084     }
00085     else
00086     {
00087         return os << "{ " << _begin << ", " << _end << " }";
00088     }
00089 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 3 14:18:52 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001