![]() |
AABBtree
0.0.0
A C++ non-recursive ND AABB tree
|
A mathematical ray in N-dimensional space. More...
#include <Ray.hxx>
Public Member Functions | |
~Ray ()=default | |
Ray ()=default | |
Ray (Ray const &r) | |
Ray (Point const &o, Vector const &d) | |
template<typename = std::enable_if<N == 1>> | |
Ray (Real const o, Real const d) | |
template<typename = std::enable_if<N == 2>> | |
Ray (Real const o_x, Real const o_y, Real const d_x, Real const d_y) | |
template<typename = std::enable_if<N == 3>> | |
Ray (Real const o_x, Real const o_y, Real const o_z, Real const d_x, Real const d_y, Real const d_z) | |
template<typename OtherReal> | |
Ray (Ray< OtherReal, N > const &r) | |
template<typename NewReal> | |
Ray< NewReal, N > | cast () const |
Point & | origin () |
Point const & | origin () const |
Vector & | direction () |
Vector const & | direction () const |
Ray & | normalize () |
Ray | normalized () const |
bool | is_approx (Ray const &r, Real const tol=DUMMY_TOL) const |
Ray & | translate (Vector const &t) |
Ray | translated (Vector const &t) const |
template<typename Transform> | |
Ray | transformed (Transform const &t) const |
template<typename Transform> | |
Ray & | transform (Transform const &t) |
bool | contains (Point const &p, Real tol=DUMMY_TOL) const |
bool | intersects (Box< Real, N > const &b, Real tol=DUMMY_TOL) const |
bool | intersect (Box< Real, N > const &b, Point &c, Point &f, Real tol=DUMMY_TOL) const |
Real | squared_distance (Point const &p, Real tol=DUMMY_TOL) const |
Real | squared_distance (Point const &p, Point &c, Real tol=DUMMY_TOL) const |
Real | distance (Point const &p, Real tol=DUMMY_TOL) const |
Real | distance (Point const &p, Point &c, Real tol=DUMMY_TOL) const |
Real | squared_interior_distance (Box< Real, N > const &b, Real tol=DUMMY_TOL) const |
Real | squared_interior_distance (Box< Real, N > const &b, Point &p1, Point &p2, Real tol=DUMMY_TOL) const |
Real | interior_distance (Box< Real, N > const &b, Real tol=DUMMY_TOL) const |
Real | interior_distance (Box< Real, N > const &b, Point &p1, Point &p2, Real tol=DUMMY_TOL) const |
Real | squared_exterior_distance (Box< Real, N > const &b, Real tol=DUMMY_TOL) const |
Real | squared_exterior_distance (Box< Real, N > const &b, Point &p1, Point &p2, Real tol=DUMMY_TOL) const |
Real | exterior_distance (Box< Real, N > const &b, Real tol=DUMMY_TOL) const |
Real | exterior_distance (Box< Real, N > const &b, Point &p1, Point &p2, Real tol=DUMMY_TOL) const |
void | print (std::ostream &os) const |
Private Types | |
using | Point = AABBtree::Point<Real, N> |
using | Vector = AABBtree::Vector<Real, N> |
Private Attributes | |
Point | m_origin |
Vector | m_direction |
Static Private Attributes | |
static constexpr Real | EPS {std::numeric_limits<Real>::epsilon()} |
static constexpr Real | INF {std::numeric_limits<Real>::infinity()} |
static constexpr Real | DUMMY_TOL {EPS*static_cast<Real>(100.0)} |
Forward declaration of the Ray class template.
Real | Type of the scalar coefficients. |
N | Dimension of the ambient space. |
This class represents a ray defined by an origin point and a direction vector. The ray extends infinitely in the direction of the vector from the origin point. The class provides functionality for:
Real | Floating-point scalar type (must be float or double). |
N | Dimension of the ambient space. |
|
private |
|
private |
|
default |
Default class destructor.
|
default |
Default class constructor.
Default class constructor that creates a ray with null origin and direction.
|
inline |
Copy constructor
[in] | r | Ray to copy |
|
inline |
Class constructor for a ray given an origin and a direction.
[in] | o | Origin of the ray. |
[in] | d | Direction of the ray. |
|
inline |
Class constructor for the 1D ray.
[in] | o | Origin of the ray. |
[in] | d | Direction of the ray. |
T | Type of the scalar coefficients. |
|
inline |
Class constructor for the 2D ray.
[in] | o_x | Origin \( x \)-axis component. |
[in] | o_y | Origin \( y \)-axis component. |
[in] | d_x | Direction \( x \)-axis component. |
[in] | d_y | Direction \( y \)-axis component. |
T | Type of the scalar coefficients. |
|
inline |
Class constructor for the 3D ray.
[in] | o_x | Origin \( x \)-axis component. |
[in] | o_y | Origin \( y \)-axis component. |
[in] | o_z | Origin \( z \)-axis component. |
[in] | d_x | Direction \( x \)-axis component. |
[in] | d_y | Direction \( y \)-axis component. |
[in] | d_z | Direction \( z \)-axis component. |
T | Type of the scalar coefficients. |
|
inlineexplicit |
Copy constructor for a ray given another ray with a different scalar type.
[in] | r | Ray to copy. |
OtherReal | Type of the scalar coefficients of the ray to copy. |
|
inline |
Cast the current object to a new scalar type.
NewReal | the new scalar type |
|
inline |
Check if the point is inside the ray.
[in] | p | Point to check. |
[in] | tol | Tolerance to use for the containment. |
|
inline |
Get the reference to the ray direction.
|
inline |
Get the const reference to the ray direction.
|
inline |
Compute the distance between the current ray a given point, returning a point at the given distance.
[in] | p | Point to compute the distance to. |
[out] | c | Closest point on the ray. |
[in] | tol | Tolerance to use for the intersection. |
|
inline |
Compute the distance between the current ray a given point.
[in] | p | Point to compute the distance to. |
[in] | tol | Tolerance to use for the intersection. |
|
inline |
Compute the exterior (or maximum) distance between the current ray a given box, and return two points at the maximum distance.
[in] | b | Box to compute the distance to. |
[out] | p1 | First point at the maximum distance (on the current ray). |
[out] | p2 | Second point at the maximum distance (on the box). |
[in] | tol | Tolerance to use for the distance computation. |
|
inline |
Compute the exterior (or maximum) distance between the current ray a given box.
[in] | b | Box to compute the distance to. |
[in] | tol | Tolerance to use for the distance computation. |
|
inline |
Compute the interior (or minimum) distance between the current ray a given box, returning two points at the minimum distance.
[in] | b | Box to compute the distance to. |
[out] | p1 | First point at the minimum distance (on the current ray). |
[out] | p2 | Second point at the minimum distance (on the box). |
[in] | tol | Tolerance to use for the distance computation. |
|
inline |
Compute the interior (or minimum) distance between the current ray a given box.
[in] | b | Box to compute the distance to. |
[in] | tol | Tolerance to use for the distance computation. |
|
inline |
Check if the current ray intersects a given axis-aligned box.
[in] | b | Box to check. |
[out] | c | Closest intersection point. |
[out] | f | Farthest intersection point. |
[in] | tol | Tolerance to use for the intersection. |
|
inline |
Check if the current ray intersects a given axis-aligned box.
[in] | b | Box to check. |
[in] | tol | Tolerance to use for the intersection. |
|
inline |
Check if the current ray is approximately equal to another ray.
[in] | r | Ray to compare with. |
[in] | tol | Tolerance to use for the comparison. |
|
inline |
Normalize the direction of the ray.
|
inline |
Normalize the direction of the ray.
|
inline |
Get the reference to the ray origin.
|
inline |
Get the const reference to the ray origin.
|
inline |
Print the ray info to an output stream.
[in] | os | Output stream to print the ray info to. |
|
inline |
Compute the squared distance between the current ray a given point, returning a point at the given distance.
[in] | p | Point to compute the distance to. |
[out] | c | Closest point on the ray. |
[in] | tol | Tolerance to use for the intersection. |
|
inline |
Compute the squared distance between the current ray a given point.
[in] | p | Point to compute the squared distance to. |
[in] | tol | Tolerance to use for the intersection. |
|
inline |
Compute the squared exterior (or maximum) distance between the current ray a given box, returning two points at the maximum distance.
[in] | b | Box to compute the squared distance to. |
[out] | p1 | First point at the maximum distance (on the current ray). |
[out] | p2 | Second point at the maximum distance (on the box). |
[in] | tol | Tolerance to use for the distance computation. |
|
inline |
Compute the squared exterior (or maximum) distance between the current ray a given box.
[in] | b | Box to compute the squared distance to. |
[in] | tol | Tolerance to use for the distance computation. |
|
inline |
Compute the squared interior (or minimum) distance between the current ray a given box, returning two points at the minimum distance.
[in] | b | Box to compute the squared distance to. |
[out] | p1 | First point at the minimum distance (on the current ray). |
[out] | p2 | Second point at the minimum distance (on the box). |
[in] | tol | Tolerance to use for the distance computation. |
|
inline |
Compute the squared interior (or minimum) distance between the current ray a given box.
[in] | b | Box to compute the squared distance to. |
[in] | tol | Tolerance to use for the distance computation. |
|
inline |
Transform the current ray by a given vector.
[in] | t | Transformation to apply to the ray. |
Transform | Type of the transformation. |
|
inline |
Transform the current ray by a given vector.
[in] | t | Transformation to apply to the ray. |
Transform | Type of the transformation. |
|
inline |
Translate the current ray by a given vector.
[in] | t | Vector to translate the ray by. |
|
inline |
Translate the current ray by a given vector.
[in] | t | Vector to translate the ray by. |
|
staticconstexprprivate |
Default tolerance for the scalar type
|
staticconstexprprivate |
Machine epsilon for the scalar type.
|
staticconstexprprivate |
Infinity value for the scalar type.
|
private |
Direction vector of the ray (not necessarily normalized).
|
private |
Origin point of the ray.