libMesh
|
Defines a Cartesian bounding box by the two corner extremum. More...
#include <bounding_box.h>
Public Member Functions | |
BoundingBox (const Point &new_min, const Point &new_max) | |
BoundingBox (const std::pair< Point, Point > &bbox) | |
BoundingBox () | |
Default constructor sets invalid bounds. More... | |
void | invalidate () |
Sets the bounding box to be "inverted". More... | |
const Point & | min () const |
Point & | min () |
const Point & | max () const |
Point & | max () |
bool | contains (const BoundingBox &) const |
bool | intersects (const BoundingBox &) const |
bool | intersects (const BoundingBox &, Real abstol) const |
bool | contains_point (const Point &) const |
bool | contains_point (const Point &p, Real abs_tol, Real rel_tol) const |
void | intersect_with (const BoundingBox &) |
Sets this bounding box to be the intersection with the other bounding box. More... | |
void | union_with (const Point &p) |
Enlarges this bounding box to include the given point. More... | |
void | union_with (const BoundingBox &) |
Sets this bounding box to be the union with the other bounding box. More... | |
Real | signed_distance (const Point &p) const |
Computes the signed distance, d, from a given Point p to this BoundingBox. More... | |
void | scale (const Real factor) |
Scales each dimension of the bounding box by factor . More... | |
Real | max_size () const |
Returns the maximum size of a finite box extent. More... | |
void | print (std::ostream &os=libMesh::out) const |
Formatted print, by default to libMesh::out . More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const BoundingBox &b) |
Formatted print as above but supports the syntax: More... | |
Defines a Cartesian bounding box by the two corner extremum.
Definition at line 40 of file bounding_box.h.
Definition at line 44 of file bounding_box.h.
Definition at line 49 of file bounding_box.h.
|
inline |
Default constructor sets invalid bounds.
Definition at line 56 of file bounding_box.h.
References invalidate().
|
inline |
true
if the other bounding box is contained in this bounding box. Exact floating point <= comparisons are performed. Definition at line 209 of file bounding_box.h.
Referenced by libMesh::NetGenMeshInterface::triangulate().
bool libMesh::BoundingBox::contains_point | ( | const Point & | p | ) | const |
true
if the bounding box contains the given point. Definition at line 35 of file bounding_box.C.
References libMesh::is_between(), and libMesh::Real.
Referenced by OutputAssembly::interior_assembly(), main(), libMesh::GmshIO::read_mesh(), signed_distance(), and ElemTest< elem_type >::test_bounding_box().
true
if the bounding box contains the given point, to within at least one of the given tolerance(s). At least one tolerance should be set to greater than zero; otherwise use the other contains_point
overload for efficiency.Relative tolerances are computed relative to the maximum finite extent of the bounding box, max_size()
Definition at line 83 of file bounding_box.C.
References libMesh::is_between(), and libMesh::Real.
void libMesh::BoundingBox::intersect_with | ( | const BoundingBox & | other_box | ) |
Sets this bounding box to be the intersection with the other bounding box.
Definition at line 123 of file bounding_box.C.
|
inline |
true
if the other bounding box has a non-empty intersection with this bounding box. Exact floating point <= comparisons are performed. Definition at line 231 of file bounding_box.h.
Referenced by libMesh::TreeNode< N >::insert(), intersects(), BBoxTest::test_no_degenerate(), BBoxTest::test_one_degenerate(), and BBoxTest::test_two_degenerate().
|
inline |
true
if the other bounding box has a non-empty intersection with this bounding box. abstol is an absolute tolerance used to make "fuzzy" comparisons. abstol must be strictly > 0.0, and both BBoxes being compared are "inflated" by abstol in each direction, i.e. (xmin, ymin, zmin) -> (xmin - abstol, ymin - abstol, zmin - abstol) (xmax, ymax, zmax) -> (xmax + abstol, ymax + abstol, zmax + abstol) before the intersection comparisons are made. This approach can be helpful for detecting intersections between two degenerate (planar) bounding boxes that lie in nearly (to within abstol) the same plane and in certain situations should be considered intersecting. Definition at line 268 of file bounding_box.h.
References intersects(), and libMesh::libmesh_assert().
|
inline |
Sets the bounding box to be "inverted".
This is a useful starting point for future union_with
operations.
Definition at line 65 of file bounding_box.h.
Referenced by BoundingBox().
|
inline |
Definition at line 86 of file bounding_box.h.
Referenced by OutputAssembly::interior_assembly(), main(), print(), libMesh::GmshIO::read_mesh(), MeshGenerationTest::testBuildCube(), MeshGenerationTest::testBuildSquare(), and union_with().
|
inline |
Definition at line 89 of file bounding_box.h.
Real libMesh::BoundingBox::max_size | ( | ) | const |
Returns the maximum size of a finite box extent.
If the bounding box is infinite (or effectively so, e.g. using numeric_limits<Real>::max()) in some dimension, then that dimension is ignored.
Definition at line 66 of file bounding_box.C.
References libMesh::libmesh_isinf(), and libMesh::Real.
|
inline |
Definition at line 77 of file bounding_box.h.
Referenced by OutputAssembly::interior_assembly(), main(), print(), libMesh::GmshIO::read_mesh(), MeshGenerationTest::testBuildCube(), MeshGenerationTest::testBuildSquare(), and union_with().
|
inline |
Definition at line 80 of file bounding_box.h.
void libMesh::BoundingBox::print | ( | std::ostream & | os = libMesh::out | ) | const |
void libMesh::BoundingBox::scale | ( | const Real | factor | ) |
Scales each dimension of the bounding box by factor
.
Has no effect for dimensions in which either min(dim) == std::numeric_limits<Real>::max() or max(dim) == -std::numeric_limits<Real>::max(), which is the "invalid" state set by the default constructor and by invalidate().
Definition at line 195 of file bounding_box.C.
References dim, and libMesh::Real.
Computes the signed distance, d, from a given Point p to this BoundingBox.
The sign convention is: d > 0 if the point is outside the BoundingBox d <= 0 if the point is inside the Bounding Box
Definition at line 158 of file bounding_box.C.
References contains_point(), and libMesh::Real.
Referenced by BBoxTest::test_signed_distance().
|
inline |
Enlarges this bounding box to include the given point.
Definition at line 286 of file bounding_box.h.
Referenced by libMesh::MeshBase::get_info(), libMesh::Cell::loose_bounding_box(), and libMesh::MeshTetInterface::volume_to_surface_mesh().
void libMesh::BoundingBox::union_with | ( | const BoundingBox & | other_box | ) |
Sets this bounding box to be the union with the other bounding box.
Definition at line 140 of file bounding_box.C.
|
friend |
Formatted print as above but supports the syntax:
Definition at line 195 of file bounding_box.h.