Represent an infinite or semi-infinite line segment with a point and a direction.
More...
|
template<int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0> |
| Ray () |
| Construct a default 2-D ray, from (0,0) pointing along the +x axis. More...
|
|
template<int Dim_ = Dim, typename std::enable_if< Dim_==3, int >::type = 0> |
| Ray () |
| Construct a default 3-D ray from (0,0,0) pointing along the +x axis. More...
|
|
| Ray (const Vector &point, const Vector &direction) |
| Construct a ray from a point and direction. More...
|
|
| Ray (const LineSegment< CoordType, Dim > &segment) |
| Construct a ray from a line segment. More...
|
|
bool | IsValid () const |
| Return whether the ray is valid or not. More...
|
|
Vector | Evaluate (CoordType param) const |
| Compute a point along the line. param values > 0 lie on the ray. More...
|
|
CoordType | DistanceTo (const Vector &point) const |
| Return the minmum distance from point to this line/ray. More...
|
|
CoordType | DistanceTo (const Vector &point, CoordType ¶m, Vector &projectedPoint) const |
| Return the minimum distance between the ray/line and point. More...
|
|
template<bool OtherTwoSided, int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0> |
bool | Intersect (const Ray< CoordType, Dim, OtherTwoSided > &other, Vector &point, CoordType tol=0.f) |
| Compute the non-degenerate point where two 2-D rays intersect, or return false. More...
|
|
template<typename CoordType = vtkm::FloatDefault, int Dim = 3, bool IsTwoSided = false>
struct vtkm::Ray< CoordType, Dim, IsTwoSided >
Represent an infinite or semi-infinite line segment with a point and a direction.
The IsTwoSided template parameter indicates whether the class represents an infinite line extending in both directions from the base point or a semi-infinite ray extending only in the positive direction from the base points.
template<typename CoordType = vtkm::FloatDefault, int Dim = 3, bool IsTwoSided = false>
template<int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0>
Construct a default 2-D ray, from (0,0) pointing along the +x axis.
template<typename CoordType = vtkm::FloatDefault, int Dim = 3, bool IsTwoSided = false>
template<int Dim_ = Dim, typename std::enable_if< Dim_==3, int >::type = 0>
Construct a default 3-D ray from (0,0,0) pointing along the +x axis.
template<typename CoordType = vtkm::FloatDefault, int Dim = 3, bool IsTwoSided = false>
CoordType vtkm::Ray< CoordType, Dim, IsTwoSided >::DistanceTo |
( |
const Vector & |
point | ) |
const |
Return the minmum distance from point to this line/ray.
Note that when the direction has zero length, this simplifies the distance between point and the ray's origin. Otherwise, the distance returned is either the perpendicular distance from point to the line or the distance to the ray's origin.
template<typename CoordType = vtkm::FloatDefault, int Dim = 3, bool IsTwoSided = false>
template<bool OtherTwoSided, int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0>
bool vtkm::Ray< CoordType, Dim, IsTwoSided >::Intersect |
( |
const Ray< CoordType, Dim, OtherTwoSided > & |
other, |
|
|
Vector & |
point, |
|
|
CoordType |
tol = 0.f |
|
) |
| |
Compute the non-degenerate point where two 2-D rays intersect, or return false.
If true is returned, then the rays intersect in a unique point and point is set to that location.
If false is returned, then either (1) the rays are parallel and may be coincident (intersect everywhere) or offset (intersect nowhere); or (2) the lines intersect but not the rays (because the the intersection occurs in the negative parameter space of one or both rays). In the latter case (2), the point is still set to the location of the intersection.
The tolerance tol is the minimum acceptable denominator used to compute the intersection point coordinates and thus dictates the maximum distance from the segments at which intersections will be reported as valid.
template<typename CoordType = vtkm::FloatDefault, int Dim = 3, bool IsTwoSided = false>
bool vtkm::Ray< CoordType, Dim, IsTwoSided >::IsValid |
( |
| ) |
const |
Return whether the ray is valid or not.
It is possible for an invalid direction (zero length) to be passed to the constructor. When this happens, the constructor divides by zero, leaving Inf in all components.