|
| Box () |
| Default constructor. More...
|
|
| Box (const Vector3d &_vec1, const Vector3d &_vec2) |
| Constructor. More...
|
|
| Box (double _vec1X, double _vec1Y, double _vec1Z, double _vec2X, double _vec2Y, double _vec2Z) |
| Constructor. More...
|
|
| Box (const Box &_b) |
| Copy Constructor. More...
|
|
virtual | ~Box () |
| Destructor. More...
|
|
math::Vector3d | Center () const |
| Get the box center. More...
|
|
bool | Contains (const Vector3d &_p) const |
| Check if a point lies inside the box. More...
|
|
std::tuple< bool, double, Vector3d > | Intersect (const Vector3d &_origin, const Vector3d &_dir, const double _min, const double _max) const |
| Check if a ray (origin, direction) intersects the box. More...
|
|
std::tuple< bool, double, Vector3d > | Intersect (const Line3d &_line) const |
| Check if a line intersects the box. More...
|
|
bool | IntersectCheck (const Vector3d &_origin, const Vector3d &_dir, const double _min, const double _max) const |
| Check if a ray (origin, direction) intersects the box. More...
|
|
std::tuple< bool, double > | IntersectDist (const Vector3d &_origin, const Vector3d &_dir, const double _min, const double _max) const |
| Check if a ray (origin, direction) intersects the box. More...
|
|
bool | Intersects (const Box &_box) const |
| Test box intersection. More...
|
|
const Vector3d & | Max () const |
| Get the maximum corner. More...
|
|
Vector3d & | Max () |
| Get a mutable version of the maximum corner. More...
|
|
void | Merge (const Box &_box) |
| Merge a box with this box. More...
|
|
const Vector3d & | Min () const |
| Get the minimum corner. More...
|
|
Vector3d & | Min () |
| Get a mutable version of the minimum corner. More...
|
|
bool | operator!= (const Box &_b) const |
| Inequality test operatoer. More...
|
|
Box | operator+ (const Box &_b) const |
| Addition operator. More...
|
|
const Box & | operator+= (const Box &_b) |
| Addition set operator. More...
|
|
Box | operator- (const Vector3d &_v) |
| Subtract a vector from the min and max values. More...
|
|
Box & | operator= (const Box &_b) |
| Assignment operator. More...
|
|
bool | operator== (const Box &_b) const |
| Equality test operatoer. More...
|
|
math::Vector3d | Size () const |
| Get the size of the box. More...
|
|
double | XLength () const |
| Get the length along the x dimension. More...
|
|
double | YLength () const |
| Get the length along the y dimension. More...
|
|
double | ZLength () const |
| Get the length along the z dimension. More...
|
|
Mathematical representation of a box and related functions.
std::tuple<bool, double, Vector3d> ignition::math::Box::Intersect |
( |
const Vector3d & |
_origin, |
|
|
const Vector3d & |
_dir, |
|
|
const double |
_min, |
|
|
const double |
_max |
|
) |
| const |
Check if a ray (origin, direction) intersects the box.
- Parameters
-
[in] | _origin | Origin of the ray. |
[in] | _dir | Direction of the ray. This ray will be normalized. |
[in] | _min | Minimum allowed distance. |
[in] | _max | Maximum allowed distance. |
- Returns
- A boolean, double, Vector3d tuple. The boolean value is true if the line intersects the box.
The double is the distance from the ray's start to the closest intersection point on the box, minus the _min distance. For example, if _min == 0.5 and the intersection happens at a distance of 2.0 from _origin then returned distance is 1.5. The double value is zero when the boolean value is false. The
Vector3d is the intersection point on the box. The Vector3d value is zero if the boolean value is false.
std::tuple<bool, double> ignition::math::Box::IntersectDist |
( |
const Vector3d & |
_origin, |
|
|
const Vector3d & |
_dir, |
|
|
const double |
_min, |
|
|
const double |
_max |
|
) |
| const |
Check if a ray (origin, direction) intersects the box.
- Parameters
-
[in] | _origin | Origin of the ray. |
[in] | _dir | Direction of the ray. This ray will be normalized. |
[in] | _min | Minimum allowed distance. |
[in] | _max | Maximum allowed distance. |
- Returns
- A boolean and double tuple. The boolean value is true if the line intersects the box.
The double is the distance from the ray's start to the closest intersection point on the box, minus the _min distance. For example, if _min == 0.5 and the intersection happens at a distance of 2.0 from _origin then returned distance is 1.5.
The double value is zero when the boolean value is false.