moab
|
#include <BoundBox.hpp>
Public Member Functions | |
BoundBox () | |
BoundBox (const CartVect &min, const CartVect &max) | |
BoundBox (const double *corners) | |
~BoundBox () | |
bool | contains_point (const double *point, const double tol=0.0) const |
bool | intersects_box (const BoundBox &b, const double tol=0.0) const |
void | compute_center (CartVect ¢er) |
void | update (const BoundBox &other_box) |
void | update (const double *coords) |
ErrorCode | update (Interface &iface, const Range &elems) |
ErrorCode | update (Interface &iface, const EntityHandle ent) |
void | update_min (const BoundBox &other_box) |
void | update_min (const double *coords) |
void | update_max (const BoundBox &other_box) |
void | update_max (const double *coords) |
ErrorCode | get (double *coords) |
double | diagonal_length () const |
Return the diagonal length of this box. | |
double | diagonal_squared () const |
Return the square of the diagonal length of this box. | |
double | distance_squared (const double *from_point) const |
Return square of distance from box, or zero if inside. | |
double | distance (const double *from_point) const |
Return distance from box, or zero if inside. | |
BoundBox & | operator= (const BoundBox &from) |
bool | operator== (const BoundBox &box) const |
Public Attributes | |
CartVect | bMin |
CartVect | bMax |
Definition at line 11 of file BoundBox.hpp.
moab::BoundBox::BoundBox | ( | ) | [inline] |
Definition at line 13 of file BoundBox.hpp.
moab::BoundBox::BoundBox | ( | const CartVect & | min, |
const CartVect & | max | ||
) | [inline] |
Definition at line 14 of file BoundBox.hpp.
moab::BoundBox::BoundBox | ( | const double * | corners | ) | [inline] |
Definition at line 62 of file BoundBox.hpp.
moab::BoundBox::~BoundBox | ( | ) | [inline] |
Definition at line 17 of file BoundBox.hpp.
{}
void moab::BoundBox::compute_center | ( | CartVect & | center | ) | [inline] |
Definition at line 134 of file BoundBox.hpp.
bool moab::BoundBox::contains_point | ( | const double * | point, |
const double | tol = 0.0 |
||
) | const [inline] |
double moab::BoundBox::diagonal_length | ( | ) | const [inline] |
double moab::BoundBox::diagonal_squared | ( | ) | const [inline] |
double moab::BoundBox::distance | ( | const double * | from_point | ) | const [inline] |
Return distance from box, or zero if inside.
from_point | Point from which you want distance |
Definition at line 164 of file BoundBox.hpp.
{ double dist_sq = distance_squared(from_point); return sqrt(dist_sq); }
double moab::BoundBox::distance_squared | ( | const double * | from_point | ) | const [inline] |
Return square of distance from box, or zero if inside.
from_point | Point from which you want distance_sq |
Definition at line 152 of file BoundBox.hpp.
ErrorCode moab::BoundBox::get | ( | double * | coords | ) | [inline] |
Definition at line 127 of file BoundBox.hpp.
{ bMin.get(coords); bMax.get(coords+3); return MB_SUCCESS; }
bool moab::BoundBox::intersects_box | ( | const BoundBox & | b, |
const double | tol = 0.0 |
||
) | const [inline] |
Definition at line 50 of file BoundBox.hpp.
bool moab::BoundBox::operator== | ( | const BoundBox & | box | ) | const [inline] |
Definition at line 55 of file BoundBox.hpp.
void moab::BoundBox::update | ( | const BoundBox & | other_box | ) | [inline] |
Definition at line 87 of file BoundBox.hpp.
{ update_min(other_box); update_max(other_box); }
void moab::BoundBox::update | ( | const double * | coords | ) | [inline] |
Definition at line 93 of file BoundBox.hpp.
{ update_min(coords); update_max(coords+3); }
ErrorCode moab::BoundBox::update | ( | Interface & | iface, |
const Range & | elems | ||
) |
Definition at line 6 of file BoundBox.cpp.
{ ErrorCode rval; bMin = CartVect(HUGE_VAL); bMax = CartVect(-HUGE_VAL); CartVect coords; EntityHandle const *conn, *conn2; int len, len2; Range::const_iterator i; // vertices const Range::const_iterator elem_begin = elems.lower_bound( MBEDGE ); for (i = elems.begin(); i != elem_begin; ++i) { rval = iface.get_coords( &*i, 1, coords.array() ); if (MB_SUCCESS != rval) return rval; update_min(coords.array()); update_max(coords.array()); } // elements with vertex-handle connectivity list const Range::const_iterator poly_begin = elems.lower_bound( MBPOLYHEDRON, elem_begin ); std::vector<EntityHandle> dum_vector; for (i = elem_begin; i != poly_begin; ++i) { rval = iface.get_connectivity( *i, conn, len, true, &dum_vector); if (MB_SUCCESS != rval) return rval; for (int j = 0; j < len; ++j) { rval = iface.get_coords( conn+j, 1, coords.array() ); if (MB_SUCCESS != rval) return rval; update_min(coords.array()); update_max(coords.array()); } } // polyhedra const Range::const_iterator set_begin = elems.lower_bound( MBENTITYSET, poly_begin ); for (i = poly_begin; i != set_begin; ++i) { rval = iface.get_connectivity( *i, conn, len, true ); if (MB_SUCCESS != rval) return rval; for (int j = 0; j < len; ++j) { rval = iface.get_connectivity( conn[j], conn2, len2 ); for (int k = 0; k < len2; ++k) { rval = iface.get_coords( conn2+k, 1, coords.array() ); if (MB_SUCCESS != rval) return rval; update_min(coords.array()); update_max(coords.array()); } } } // sets BoundBox box; for (i = set_begin; i != elems.end(); ++i) { Range tmp_elems; rval = iface.get_entities_by_handle(*i, tmp_elems); if (MB_SUCCESS != rval) return rval; rval = box.update(iface, tmp_elems); if (MB_SUCCESS != rval) return rval; update(box); } return MB_SUCCESS; }
ErrorCode moab::BoundBox::update | ( | Interface & | iface, |
const EntityHandle | ent | ||
) | [inline] |
Definition at line 146 of file BoundBox.hpp.
void moab::BoundBox::update_max | ( | const BoundBox & | other_box | ) | [inline] |
void moab::BoundBox::update_max | ( | const double * | coords | ) | [inline] |
void moab::BoundBox::update_min | ( | const BoundBox & | other_box | ) | [inline] |
void moab::BoundBox::update_min | ( | const double * | coords | ) | [inline] |
Definition at line 59 of file BoundBox.hpp.
Definition at line 59 of file BoundBox.hpp.