Oriented bounding box. More...
#include <OrientedBox.hpp>
Classes | |
struct | CovarienceData |
Public Member Functions | |
OrientedBox () | |
OrientedBox (const Matrix3 &axes_mat, const CartVect ¢er) | |
OrientedBox (const CartVect axes_in[3], const CartVect ¢er) | |
double | inner_radius () const |
radius of inscribed sphere More... | |
double | outer_radius () const |
radius of circumscribed sphere More... | |
double | outer_radius_squared (const double reps) const |
square of (radius+at least epsilon) of circumsphere More... | |
double | inner_radius_squared (const double reps) const |
square of (radius-epsilon) of inscribed sphere More... | |
double | volume () const |
volume of box More... | |
CartVect | dimensions () const |
number of dimensions for which box is not flat More... | |
double | area () const |
largest side area More... | |
CartVect | axis (int index) const |
get unit vector in direction of axis More... | |
CartVect | scaled_axis (int index) const |
get vector in direction of axis, scaled to its true length More... | |
bool | contained (const CartVect &point, double tolerance) const |
bool | intersect_ray (const CartVect &ray_start_point, const CartVect &ray_unit_direction, const double distance_tolerance, const double *nonnegatve_ray_len=0, const double *negative_ray_len=0) const |
void | closest_location_in_box (const CartVect &input_position, CartVect &output_position) const |
Find closest position on/within box to input position. More... | |
ErrorCode | make_hex (EntityHandle &hex, Interface *instance) |
Construct a hexahedral element with the same shape as this box. More... | |
Static Public Member Functions | |
static ErrorCode | tag_handle (Tag &handle_out, Interface *instance, const char *name) |
get tag handle for storing oriented box More... | |
static ErrorCode | compute_from_vertices (OrientedBox &result, Interface *instance, const Range &vertices) |
Calculate an oriented box from a set of vertices. More... | |
static ErrorCode | compute_from_2d_cells (OrientedBox &result, Interface *instance, const Range &elements) |
Calculate an oriented box from a set of 2D elements. More... | |
static ErrorCode | covariance_data_from_tris (CovarienceData &result, Interface *moab_instance, const Range &elements) |
static ErrorCode | compute_from_covariance_data (OrientedBox &result, Interface *moab_instance, const CovarienceData *orient_array, unsigned orient_array_length, const Range &vertices) |
static ErrorCode | compute_from_covariance_data (OrientedBox &result, Interface *moab_instance, CovarienceData &orientation_data, const Range &vertices) |
Public Attributes | |
CartVect | center |
Box center. More... | |
Matrix3 | axes |
Box axes, unit vectors sorted by extent of box along axis. More... | |
CartVect | length |
distance from center to plane along each axis More... | |
double | radius |
outer radius (1/2 diagonal length) of box More... | |
Private Member Functions | |
void | order_axes_by_length (double ax1_len, double ax2_len, double ax3_len) |
orders the box axes by the given lengths for each axis More... | |
Oriented bounding box.
Definition at line 40 of file OrientedBox.hpp.
|
inline |
Definition at line 129 of file OrientedBox.cpp.
References axes, moab::Matrix3::col(), moab::CartVect::length(), and order_axes_by_length().
Definition at line 121 of file OrientedBox.cpp.
References axes, length, and order_axes_by_length().
|
inline |
largest side area
Definition at line 228 of file OrientedBox.hpp.
References axes, moab::Matrix3::col(), and length.
Referenced by moab::OrientedBoxTreeTool::recursive_stats().
|
inline |
get unit vector in direction of axis
Definition at line 237 of file OrientedBox.hpp.
References axes, and moab::Matrix3::col().
Referenced by moab::TreeNodePrinter::print_geometry().
void moab::OrientedBox::closest_location_in_box | ( | const CartVect & | input_position, |
CartVect & | output_position | ||
) | const |
Find closest position on/within box to input position.
Find the closest position in the solid box to the input position. If the input position is on or within the box, then the output position will be the same as the input position. If the input position is outside the box, the outside position will be the closest point on the box boundary to the input position.
Definition at line 658 of file OrientedBox.cpp.
References axes, center, moab::Matrix3::col(), and length.
Referenced by moab::OrientedBoxTreeTool::closest_to_location(), and moab::OrientedBoxTreeTool::sphere_intersect_triangles().
|
static |
Calculate an oriented box from a set of 2D elements.
Definition at line 311 of file OrientedBox.cpp.
References compute_from_covariance_data(), covariance_data_from_tris(), ErrorCode, moab::Interface::get_adjacencies(), MB_SUCCESS, and moab::Interface::UNION.
Referenced by moab::OrientedBoxTreeTool::build_tree().
|
static |
Calculate an OrientedBox given an array of CovarienceData and the list of vertices the box is to bound.
Definition at line 372 of file OrientedBox.cpp.
References moab::OrientedBox::CovarienceData::area, moab::OrientedBox::CovarienceData::center, and moab::OrientedBox::CovarienceData::matrix.
Referenced by moab::OrientedBoxTreeTool::build_sets(), and compute_from_2d_cells().
|
static |
Calculate an OrientedBox given a CovarienceData struct and the list of points the box is to bound.
Definition at line 327 of file OrientedBox.cpp.
References moab::OrientedBox::CovarienceData::area, axes, moab::box_from_axes(), center, moab::OrientedBox::CovarienceData::center, moab::Matrix3::eigen_decomposition(), moab::OrientedBox::CovarienceData::matrix, MB_SUCCESS, OrientedBox(), and moab::outer_product().
|
static |
Calculate an oriented box from a set of vertices.
Definition at line 231 of file OrientedBox.cpp.
References moab::CartVect::array(), axes, moab::box_from_axes(), center, moab::Matrix3::eigen_decomposition(), ErrorCode, moab::Interface::get_coords(), moab::Range::lower_bound(), MB_SUCCESS, MBVERTEX, moab::outer_product(), and moab::Range::upper_bound().
bool moab::OrientedBox::contained | ( | const CartVect & | point, |
double | tolerance | ||
) | const |
Test if point is contained in box
Definition at line 355 of file OrientedBox.cpp.
References axes, center, moab::Matrix3::col(), moab::CartVect::length(), and length.
Referenced by TriCounter::visit().
|
static |
Calculate a CovarienceData struct from a list of triangles
Definition at line 269 of file OrientedBox.cpp.
References moab::OrientedBox::CovarienceData::area, moab::OrientedBox::CovarienceData::center, ErrorCode, moab::GeomUtil::first(), moab::Interface::get_connectivity(), moab::Interface::get_coords(), length, moab::Range::lower_bound(), moab::OrientedBox::CovarienceData::matrix, MB_SUCCESS, moab::outer_product(), and moab::CN::TypeDimensionMap.
Referenced by compute_from_2d_cells(), and moab::OrientedBoxTreeTool::join_trees().
|
inline |
number of dimensions for which box is not flat
Definition at line 219 of file OrientedBox.hpp.
References axes, moab::Matrix3::col(), moab::CartVect::length(), and length.
Referenced by moab::TreeNodePrinter::print_geometry(), and moab::OrientedBoxTreeTool::recursive_stats().
|
inline |
radius of inscribed sphere
Definition at line 163 of file OrientedBox.hpp.
References axes, moab::Matrix3::col(), moab::CartVect::length(), and length.
Referenced by moab::TreeNodePrinter::print_geometry(), and moab::OrientedBoxTreeTool::recursive_stats().
|
inline |
square of (radius-epsilon) of inscribed sphere
Definition at line 199 of file OrientedBox.hpp.
References axes, moab::Matrix3::col(), and length.
Referenced by intersect_ray().
bool moab::OrientedBox::intersect_ray | ( | const CartVect & | ray_start_point, |
const CartVect & | ray_unit_direction, | ||
const double | distance_tolerance, | ||
const double * | nonnegatve_ray_len = 0 , |
||
const double * | negative_ray_len = 0 |
||
) | const |
Test for intersection of a ray (or line segment) with this box. Ray length limits are used to optimize Monte Carlo particle tracking.
ray_start_point | The base point of the ray |
ray_unit_direction | The direction of the ray (must be unit length) |
distance_tolerance | Tolerance to use in intersection checks |
nonnegative_ray_len | Optional length of ray in forward direction |
negative_ray_len | Optional length of ray in reverse direction |
Definition at line 498 of file OrientedBox.cpp.
References axes, center, moab::check_ray_limits(), inner_radius_squared(), length, outer_radius_squared(), and moab::Matrix3::transpose().
ErrorCode moab::OrientedBox::make_hex | ( | EntityHandle & | hex, |
Interface * | instance | ||
) |
Construct a hexahedral element with the same shape as this box.
Definition at line 620 of file OrientedBox.cpp.
References moab::CartVect::array(), axes, center, moab::Matrix3::col(), moab::Interface::create_element(), moab::Interface::create_vertex(), moab::Interface::delete_entities(), ErrorCode, length, MB_SUCCESS, and MBHEX.
|
private |
orders the box axes by the given lengths for each axis
Definition at line 85 of file OrientedBox.cpp.
References axes, moab::Matrix3::colscale(), moab::CartVect::length(), length, radius, and moab::Matrix3::swapcol().
Referenced by OrientedBox().
|
inline |
radius of circumscribed sphere
Definition at line 172 of file OrientedBox.hpp.
References axes, moab::Matrix3::col(), moab::CartVect::length(), length, and radius.
Referenced by moab::TreeNodePrinter::print_geometry(), and moab::OrientedBoxTreeTool::recursive_stats().
|
inline |
square of (radius+at least epsilon) of circumsphere
Definition at line 184 of file OrientedBox.hpp.
References axes, moab::Matrix3::col(), length, and radius.
Referenced by intersect_ray().
|
inline |
get vector in direction of axis, scaled to its true length
Definition at line 242 of file OrientedBox.hpp.
References axes, moab::Matrix3::col(), and length.
Referenced by moab::OrientedBoxTreeTool::box().
|
static |
get tag handle for storing oriented box
Get the handle for the tag with the specified name and check that the tag is appropriate for storing instances of OrientedBox. The resulting tag may be used to store instances of OrientedBox directly.
handle_out | The TagHandle, passed back to caller |
name | The tag name |
create | If true, tag will be created if it does not exist |
Definition at line 134 of file OrientedBox.cpp.
References MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_DOUBLE, and moab::Interface::tag_get_handle().
Referenced by moab::OrientedBoxTreeTool::OrientedBoxTreeTool().
|
inline |
volume of box
Definition at line 210 of file OrientedBox.hpp.
References axes, moab::Matrix3::col(), and length.
Referenced by TriStats::leaf(), moab::OrientedBoxTreeTool::recursive_stats(), and TriStats::TriStats().
Matrix3 moab::OrientedBox::axes |
Box axes, unit vectors sorted by extent of box along axis.
Definition at line 49 of file OrientedBox.hpp.
Referenced by area(), axis(), moab::box_from_axes(), closest_location_in_box(), compute_from_covariance_data(), compute_from_vertices(), contained(), dimensions(), inner_radius(), inner_radius_squared(), intersect_ray(), make_hex(), moab::operator<<(), order_axes_by_length(), OrientedBox(), outer_radius(), outer_radius_squared(), scaled_axis(), and volume().
CartVect moab::OrientedBox::center |
Box center.
Definition at line 48 of file OrientedBox.hpp.
Referenced by moab::OrientedBoxTreeTool::box(), moab::box_from_axes(), closest_location_in_box(), compute_from_covariance_data(), compute_from_vertices(), contained(), intersect_ray(), make_hex(), moab::operator<<(), and moab::TreeNodePrinter::print_geometry().
CartVect moab::OrientedBox::length |
distance from center to plane along each axis
Definition at line 51 of file OrientedBox.hpp.
Referenced by area(), moab::box_from_axes(), closest_location_in_box(), contained(), covariance_data_from_tris(), dimensions(), inner_radius(), inner_radius_squared(), intersect_ray(), make_hex(), moab::operator<<(), order_axes_by_length(), OrientedBox(), outer_radius(), outer_radius_squared(), scaled_axis(), and volume().
double moab::OrientedBox::radius |
outer radius (1/2 diagonal length) of box
Definition at line 54 of file OrientedBox.hpp.
Referenced by moab::box_from_axes(), order_axes_by_length(), outer_radius(), and outer_radius_squared().