35 #ifndef THE_AA_BBOX_HXX_
36 #define THE_AA_BBOX_HXX_
42 #include <Core/ITKCommon/v3x1p3x1.hxx>
90 min_.assign(FLT_MAX, FLT_MAX, FLT_MAX);
91 max_.assign(-FLT_MAX, -FLT_MAX, -FLT_MAX);
101 return ret_val += bbox;
125 {
return (*
this + (-r)); }
128 {
return (*
this += (-r)); }
132 {
return ((min_ == bbox.min_) && (max_ == bbox.max_)); }
135 {
return !((*this) == bbox); }
140 {
return (volume() < bbox.volume()); }
143 inline float volume()
const
145 if (is_empty())
return 0.0;
146 return (max_[0] - min_[0]) * (max_[1] - min_[1]) * (max_[2] - min_[2]);
151 void corners(
p3x1_t * corner_array)
const;
154 bool is_empty()
const;
156 inline bool is_singular()
const
157 {
return (min_ == max_); }
159 bool is_linear()
const;
160 bool is_planar()
const;
161 bool is_spacial()
const;
164 inline float length(
const unsigned int & axis_id)
const
165 {
return (max_[axis_id] - min_[axis_id]); }
168 inline p3x1_t center()
const
169 {
return 0.5f * (max_ + min_); }
172 float radius(
const p3x1_t & center)
const;
174 inline float radius()
const
175 {
return 0.5f * diameter(); }
177 inline float diameter()
const
179 if (is_empty())
return 0;
180 return (min_ - max_).norm();
184 float radius(
const p3x1_t & center,
const unsigned int & axis_w_id)
const;
186 inline float radius(
const unsigned int & axis_w_id)
const
187 {
return radius(center(), axis_w_id); }
192 void contains(
const p3x1_t & pt,
193 bool & contained_in_x,
194 bool & contained_in_y,
195 bool & contained_in_z)
const;
198 inline bool contains(
const p3x1_t & pt)
const
200 bool contained_in_x =
false;
201 bool contained_in_y =
false;
202 bool contained_in_z =
false;
203 contains(pt, contained_in_x, contained_in_y, contained_in_z);
204 return (contained_in_x && contained_in_y && contained_in_z);
209 {
return contains(bbox.min_) && contains(bbox.max_); }
227 bool intersects_ray(
const p3x1_t & o,
230 float & t_max)
const;
233 unsigned int largest_dimension()
const;
234 unsigned int smallest_dimension()
const;
237 void dump(ostream & strm)
const;
262 #endif // THE_AA_BBOX_HXX_
Definition: v3x1p3x1.hxx:826
Definition: v3x1p3x1.hxx:579
the_aa_bbox_t & operator<<(const p3x1_t &pt)
Definition: the_aa_bbox.cxx:47
Definition: the_aa_bbox.hxx:81