|
Moby
|
An oriented bounding box that optionally allows building an OBB tree. More...
#include <OBB.h>
Public Member Functions | |
| OBB (const OBB &obb) | |
| OBB (const Point3d ¢er, const Ravelin::Matrix3d &R, const Ravelin::Vector3d &l) | |
| OBB (const OBB &o, const Ravelin::Vector3d &v) | |
| OBB & | operator= (const OBB &obb) |
| Copies an OBB. More... | |
| virtual void | transform (const Ravelin::Transform3d &T, BV *result) const |
| Transforms the OBB using the given transform. | |
| virtual BVPtr | calc_swept_BV (CollisionGeometryPtr g, const Ravelin::SVelocityd &v) const |
| Calculates the velocity-expanded OBB for a body. | |
| virtual bool | intersects (const LineSeg3 &seg, double &tmin, double tmax, Point3d &q) const |
| Determines whether a line segment intersects the bounding volume. | |
| virtual bool | outside (const Point3d &point, double tol=NEAR_ZERO) const |
| Determines whether a point is outside the bounding volume. | |
| virtual std::ostream & | to_vrml (std::ostream &out, const Ravelin::Pose3d &T) const |
| Outputs the OBB in VRML format to the given stream. | |
| unsigned | calc_size () const |
| Constructs an OBB from a triangle mesh using the mesh inertia method [Ericson, 2003]. More... | |
| XMLTreePtr | save_to_xml_tree () const |
| Saves a OBB hiearchy to a XMLTree. | |
|
virtual boost::shared_ptr < const Ravelin::Pose3d > | get_relative_pose () const |
| Gets the associated pose for this bounding volume. | |
| virtual Point3d | get_lower_bounds () const |
| Gets the lower bounds on the OBB. | |
| virtual Point3d | get_upper_bounds () const |
| Gets the upper bounds on the OBB. | |
| template<class ForwardIterator > | |
| void | expand_to_fit (ForwardIterator begin, ForwardIterator end) |
| Expands this OBB (if necessary) to fit the given points. More... | |
| template<class ForwardIterator > | |
| OBB (ForwardIterator begin, ForwardIterator end) | |
| Computes an OBB from a set of points. More... | |
| template<class OutputIterator > | |
| OutputIterator | get_vertices (OutputIterator begin) const |
| Gets the eight vertices of the bounding box. More... | |
| virtual double | calc_volume () const |
| Calculates 1/8th of the volume of the bounding box. | |
| template<class ForwardIterator > | |
| OBB | calc_low_dim_OBB (ForwardIterator begin, ForwardIterator end) |
| Computes the minimum OBB from a set of lower dimensional (< 3d) points. More... | |
| template<class ForwardIterator > | |
| OBB | calc_min_volume_OBB (ForwardIterator begin, ForwardIterator end) |
| Computes the minimum OBB from a set of points. More... | |
| template<class ForwardIterator > | |
| OBB (ForwardIterator begin, ForwardIterator end) | |
| Computes an OBB from a set of points. More... | |
| template<class ForwardIterator > | |
| void | expand_to_fit (ForwardIterator begin, ForwardIterator end) |
| Expands this OBB (if necessary) to fit the given points. More... | |
| template<class ForwardIterator > | |
| void | align (ForwardIterator begin, ForwardIterator end, const Ravelin::Vector3d &d1, Ravelin::Vector3d &d2) |
| Aligns this OBB with the minimum area bounding rectangle projected along the first dimension of the OBB. | |
| template<class OutputIterator > | |
| OutputIterator | get_vertices (OutputIterator begin) const |
| Gets the eight vertices of the bounding box. More... | |
| template<class ForwardIterator > | |
| void | calc_lengths (const Ravelin::Vector3d &d1, const Ravelin::Vector3d &d2, const Ravelin::Vector3d &d3, const Point3d ¢er, ForwardIterator begin, ForwardIterator end, double lengths[3]) |
Public Member Functions inherited from Moby::BV | |
| BVPtr | get_this () |
| boost::shared_ptr< const BV > | get_this () const |
| bool | is_leaf () const |
| template<class OutputIterator > | |
| OutputIterator | get_all_BVs (OutputIterator begin) const |
| Gets all BV nodes. More... | |
| template<class OutputIterator > | |
| OutputIterator | get_all_leafs (OutputIterator begin) const |
| Gets all leaf nodes. | |
| template<class OutputIterator > | |
| OutputIterator | get_all_BVs (OutputIterator begin) const |
| Gets all BV nodes. More... | |
| template<class OutputIterator > | |
| OutputIterator | get_all_leafs (OutputIterator begin) const |
| Gets all leaf nodes. | |
| template<class OutputIterator > | |
| OutputIterator | intersect_BV_trees (BVPtr a, BVPtr b, const Ravelin::Transform3d &aTb, const Ravelin::Transform3d &bTa, OutputIterator output_begin) |
| Intersects two BV trees; returns list of all leaf-level intersecting BVs. More... | |
Static Public Member Functions | |
| static double | calc_sq_dist (const OBB &o, const Point3d &p) |
| Computes the squared distance from a point to an OBB. | |
| static double | calc_dist (const OBB &a, const OBB &b, Point3d &cpa, Point3d &cpb) |
| Determines the distance between two OBBs. | |
| static double | calc_dist (const OBB &a, const OBB &b, const Ravelin::Transform3d &aTb, Point3d &cpa, Point3d &cpb) |
| static bool | intersects (const OBB &a, const OBB &b) |
| Determines whether two OBBs intersect another. More... | |
| static bool | intersects (const OBB &a, const OBB &b, const Ravelin::Transform3d &aTb) |
| static bool | intersects (const OBB &a, const LineSeg3 &seg, double &tmin, double tmax, Point3d &q) |
| Determines whether an OBB and a line/ray/line segment intersect. More... | |
| static bool | outside (const OBB &a, const Point3d &point, double tol=NEAR_ZERO) |
| Determines whether a point is outside a OBB to within the given tolerance. | |
| static OBBPtr | load_from_xml (boost::shared_ptr< const XMLTree > root) |
| Loads an OBB hierarchy from a XML tree. | |
| template<class ForwardIterator > | |
| static OBB | calc_min_volume_OBB (ForwardIterator begin, ForwardIterator end) |
| Computes the minimum OBB from a set of points. More... | |
Static Public Member Functions inherited from Moby::BV | |
| static bool | intersects (BVPtr a, BVPtr b) |
| Convenience method. | |
| static bool | intersects (BVPtr a, BVPtr b, const Ravelin::Transform3d &T) |
| Convenience method. | |
| static double | calc_distance (BVPtr a, BVPtr b, Point3d &cp1, Point3d &cp2) |
| Convenience method. | |
| static double | calc_distance (BVPtr a, BVPtr b, const Ravelin::Transform3d &aTb, Point3d &cp1, Point3d &cp2) |
| Convenience method. | |
| static bool | intersects (const BV *a, const BV *b) |
| Computes whether two abstract bounding volumes intersect. | |
| static bool | intersects (const BV *a, const BV *b, const Ravelin::Transform3d &T) |
| static double | calc_distance (const BV *a, const BV *b, Point3d &cp1, Point3d &cp2) |
| Computes the distance between two abstract bounding volumes and stores the closest points. More... | |
| static double | calc_distance (const BV *a, const BV *b, const Ravelin::Transform3d &aTb, Point3d &cp1, Point3d &cp2) |
| template<class OutputIterator > | |
| static OutputIterator | intersect_BV_trees (BVPtr a, BVPtr b, const Ravelin::Transform3d &aTb, const Ravelin::Transform3d &bTa, OutputIterator output_begin) |
| Intersects two BV trees; returns list of all leaf-level intersecting BVs. More... | |
Public Attributes | |
| Point3d | center |
| Center of the bounding box. | |
| Ravelin::Vector3d | l |
| Half-lengths of the OBBs in the three axes directions (i.e., in the box frame) | |
| Ravelin::Matrix3d | R |
| Orientation of this OBB. | |
Public Attributes inherited from Moby::BV | |
| boost::shared_ptr< void > | userdata |
| Userdata for the BV. | |
| CollisionGeometryPtr | geom |
| The collision geometry associated with this bounding volume. | |
| std::list< BVPtr > | children |
| The children of this BV. | |
An oriented bounding box that optionally allows building an OBB tree.
| Moby::OBB::OBB | ( | ForwardIterator | begin, |
| ForwardIterator | end | ||
| ) |
Computes an OBB from a set of points.
| begin | an iterator to type Point3d |
| end | an iterator to type Point3d Algorithm taken from [Ericson, 2005] |
| Moby::OBB::OBB | ( | ForwardIterator | begin, |
| ForwardIterator | end | ||
| ) |
Computes an OBB from a set of points.
| begin | an iterator to type Point3d |
| end | an iterator to type Point3d Algorithm taken from [Ericson, 2005] |
References Moby::IndexedTri::a, Moby::IndexedTri::b, and Moby::IndexedTri::c.
| OBB Moby::OBB::calc_low_dim_OBB | ( | ForwardIterator | begin, |
| ForwardIterator | end | ||
| ) |
|
static |
Computes the minimum OBB from a set of points.
| begin | an iterator to type Point3d |
| end | an iterator to type Point3d Algorithm taken from http://www.geometrictools.com - thanks Dave Eberly! |
| OBB Moby::OBB::calc_min_volume_OBB | ( | ForwardIterator | begin, |
| ForwardIterator | end | ||
| ) |
Computes the minimum OBB from a set of points.
| begin | an iterator to type Point3d |
| end | an iterator to type Point3d Algorithm taken from http://www.geometrictools.com - thanks Dave Eberly! |
References calc_volume(), center, Moby::IndexedTriArray::determine_edge_facet_map(), Moby::IndexedTriArray::determine_vertex_edge_map(), Moby::IndexedTriArray::get_triangle(), Moby::IndexedTriArray::get_vertices(), Moby::IndexedTriArray::is_coplanar(), l, and R.
| unsigned OBB::calc_size | ( | ) | const |
| void Moby::OBB::expand_to_fit | ( | ForwardIterator | begin, |
| ForwardIterator | end | ||
| ) |
Expands this OBB (if necessary) to fit the given points.
| begin | an iterator to the beginning of a container of type Ravelin:Point3d: |
| end | an iterator to the end of a container of type Point3d |
| void Moby::OBB::expand_to_fit | ( | ForwardIterator | begin, |
| ForwardIterator | end | ||
| ) |
Expands this OBB (if necessary) to fit the given points.
| begin | an iterator to the beginning of a container of type Ravelin:Point3d: |
| end | an iterator to the end of a container of type Point3d |
| OutputIterator Moby::OBB::get_vertices | ( | OutputIterator | begin | ) | const |
Gets the eight vertices of the bounding box.
| OutputIterator Moby::OBB::get_vertices | ( | OutputIterator | begin | ) | const |
Gets the eight vertices of the bounding box.
Determines whether two OBBs intersect another.
Code adapted from [Ericson, 2005]
References get_relative_pose().
Referenced by intersects().
|
static |
Determines whether an OBB and a line/ray/line segment intersect.
When intersecting, return intersection distance tmin and point q of intersection.
| a | the OBB to check for intersection |
| seg | the line segment to check for intersection |
| tmin | on entry, contains the minimum value of the line parameter- for a line segment, this will generally be 0; when an intersection occurs, this will contain the distance of intersection from the tmin that was input on return |
| tmax | the maximum value of the line parameter- for a line segment, this will generally be 1 |
| q | contains the point of intersection, if any, on return |
References center, get_relative_pose(), and R.
Copies an OBB.
References center, Moby::BV::geom, l, and R.
1.8.6