14#ifndef OSG_BOUNDINGBOX
15#define OSG_BOUNDINGBOX 1
26class BoundingSphereImpl;
64 _max(xmax,ymax,zmax) {}
95 _min.set(xmin,ymin,zmin);
96 _max.set(xmax,ymax,zmax);
141 return 0.25*((
_max-
_min).length2());
187 if (!bb.
valid())
return;
201 template<
typename BST>
204 if (!sh.
valid())
return;
245 ((v.
x()+epsilon)>=
_min.x() && (v.
x()-epsilon)<=
_max.x()) &&
246 ((v.
y()+epsilon)>=
_min.y() && (v.
y()-epsilon)<=
_max.y()) &&
247 ((v.
z()+epsilon)>=
_min.z() && (v.
z()-epsilon)<=
_max.z());
254#ifdef OSG_USE_FLOAT_BOUNDINGBOX
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
BoundingBoxImpl< Vec3d > BoundingBoxd
Definition BoundingBox:252
BoundingBoxd BoundingBox
Definition BoundingBox:257
BoundingBoxImpl< Vec3f > BoundingBoxf
Definition BoundingBox:251
T maximum(T lhs, T rhs)
return the maximum of two values, equivalent to std::max.
Definition Math:85
T minimum(T lhs, T rhs)
return the minimum of two values, equivalent to std::min.
Definition Math:78
General purpose bounding sphere class for enclosing nodes/objects/vertices.
Definition BoundingSphere:35
value_type _radius
Definition BoundingSphere:41
vec_type _center
Definition BoundingSphere:40
bool valid() const
Returns true of the bounding sphere extents are valid, false otherwise.
Definition BoundingSphere:64
General purpose axis-aligned bounding box class for enclosing objects/vertices.
Definition BoundingBox:34
value_type zMax() const
Definition BoundingBox:123
const vec_type center() const
Calculates and returns the bounding box center.
Definition BoundingBox:126
VT::value_type value_type
Definition BoundingBox:37
bool intersects(const BoundingBoxImpl &bb) const
Return true if this bounding box intersects the specified bounding box.
Definition BoundingBox:225
value_type & xMax()
Definition BoundingBox:116
value_type & yMin()
Definition BoundingBox:110
BoundingBoxImpl(const BoundingBoxImpl< BT > &bb)
Definition BoundingBox:55
value_type & xMin()
Definition BoundingBox:107
value_type & zMin()
Definition BoundingBox:113
value_type xMax() const
Definition BoundingBox:117
void expandBy(value_type x, value_type y, value_type z)
Expands the bounding box to include the given coordinate.
Definition BoundingBox:171
BoundingBoxImpl(value_type xmin, value_type ymin, value_type zmin, value_type xmax, value_type ymax, value_type zmax)
Creates a bounding box initialized to the given extents.
Definition BoundingBox:61
vec_type _max
Definition BoundingBox:42
bool contains(const vec_type &v, value_type epsilon) const
Returns true if this bounding box contains the specified coordinate allowing for specific epsilon.
Definition BoundingBox:242
void expandBy(const vec_type &v)
Expands the bounding box to include the given coordinate.
Definition BoundingBox:156
bool operator==(const BoundingBoxImpl &rhs) const
Definition BoundingBox:82
value_type & zMax()
Definition BoundingBox:122
value_type xMin() const
Definition BoundingBox:108
void set(value_type xmin, value_type ymin, value_type zmin, value_type xmax, value_type ymax, value_type zmax)
Sets the bounding box extents.
Definition BoundingBox:92
BoundingBoxImpl intersect(const BoundingBoxImpl &bb) const
Returns the intersection of this bounding box and the specified bounding box.
Definition BoundingBox:218
const vec_type corner(unsigned int pos) const
Returns a specific corner of the bounding box.
Definition BoundingBox:149
bool valid() const
Returns true if the bounding box extents are valid, false otherwise.
Definition BoundingBox:86
vec_type _min
Definition BoundingBox:40
void expandBy(const BoundingBoxImpl &bb)
Expands this bounding box to include the given bounding box.
Definition BoundingBox:185
void expandBy(const BoundingSphereImpl< BST > &sh)
Expands this bounding box to include the given sphere.
Definition BoundingBox:202
bool operator!=(const BoundingBoxImpl &rhs) const
Definition BoundingBox:83
BoundingBoxImpl()
Creates an uninitialized bounding box.
Definition BoundingBox:45
bool contains(const vec_type &v) const
Returns true if this bounding box contains the specified coordinate.
Definition BoundingBox:233
void set(const vec_type &min, const vec_type &max)
Sets the bounding box extents.
Definition BoundingBox:100
VT vec_type
Definition BoundingBox:36
value_type yMax() const
Definition BoundingBox:120
value_type zMin() const
Definition BoundingBox:114
void init()
Clear the bounding box.
Definition BoundingBox:72
value_type radius2() const
Calculates and returns the squared length of the bounding box radius.
Definition BoundingBox:139
value_type & yMax()
Definition BoundingBox:119
value_type radius() const
Calculates and returns the bounding box radius.
Definition BoundingBox:132
value_type yMin() const
Definition BoundingBox:111
BoundingBoxImpl(const vec_type &min, const vec_type &max)
Creates a bounding box initialized to the given extents.
Definition BoundingBox:67
value_type & z()
Definition Vec3f:82
value_type & y()
Definition Vec3f:81
value_type & x()
Definition Vec3f:80