7#ifndef PXR_BASE_GF_RAY_H
8#define PXR_BASE_GF_RAY_H
15#include "pxr/base/gf/api.h"
21PXR_NAMESPACE_OPEN_SCOPE
80 return _startPoint + distance * _direction;
92 double *rayDistance = NULL)
const;
97 return (_startPoint == r._startPoint &&
98 _direction == r._direction);
104 return ! (*
this == r);
138 double *distance = NULL,
139 GfVec3d *barycentricCoords = NULL,
140 bool *frontFacing = NULL,
141 double maxDist = std::numeric_limits<double>::infinity())
153 bool *frontFacing = NULL)
const;
161 double *enterDistance = NULL,
162 double *exitDistance = NULL)
const;
170 double *enterDistance = NULL,
171 double *exitDistance = NULL)
const;
179 double *enterDistance = NULL,
180 double *exitDistance = NULL )
const;
194 double *enterDistance = NULL,
195 double *exitDistance = NULL)
const;
211 double *enterDistance = NULL,
212 double *exitDistance = NULL)
const;
219 double *,
double * );
223 double *,
double * );
228 bool _SolveQuadratic(
const double a,
231 double *enterDistance = NULL,
232 double *exitDistance = NULL)
const;
251 double *rayDistance =
nullptr,
252 double *lineDistance =
nullptr );
265 double *rayDistance =
nullptr,
266 double *segDistance =
nullptr );
272PXR_NAMESPACE_CLOSE_SCOPE
Basic type: arbitrarily oriented 3D bounding box.
Basic type: 3D line segment.
Stores a 4x4 matrix of double elements.
Basic type: 3-dimensional plane.
Basic type: 3-dimensional floating point range.
Basic type: Ray used for intersection testing.
GfRay(const GfVec3d &startPoint, const GfVec3d &direction)
This constructor takes a starting point and a direction.
GF_API GfVec3d FindClosestPoint(const GfVec3d &point, double *rayDistance=NULL) const
Returns the point on the ray that is closest to point.
GF_API bool Intersect(const GfVec3d &origin, const GfVec3d &axis, const double radius, const double height, double *enterDistance=NULL, double *exitDistance=NULL) const
Intersects the ray with an infinite non-double cone, centered at origin, with axis axis,...
bool operator!=(const GfRay &r) const
Component-wise inequality test.
GfVec3d GetPoint(double distance) const
Returns the point that is distance units from the starting point along the direction vector,...
const GfVec3d & GetDirection() const
Returns the direction vector of the segment.
GF_API void SetPointAndDirection(const GfVec3d &startPoint, const GfVec3d &direction)
Sets the ray by specifying a starting point and a direction.
GF_API bool Intersect(const GfVec3d &origin, const GfVec3d &axis, const double radius, double *enterDistance=NULL, double *exitDistance=NULL) const
Intersects the ray with an infinite cylinder, with axis axis, centered at the origin,...
GF_API bool Intersect(const GfPlane &plane, double *distance=NULL, bool *frontFacing=NULL) const
Intersects the ray with a plane, returning true if the ray is not parallel to the plane and the inter...
GF_API friend bool GfFindClosestPoints(const GfRay &, const GfLine &, GfVec3d *, GfVec3d *, double *, double *)
Computes the closest points between a ray and a line.
GF_API GfRay & Transform(const GfMatrix4d &matrix)
Transforms the ray by the given matrix.
GfRay()
The default constructor leaves the ray parameters undefined.
const GfVec3d & GetStartPoint() const
Returns the starting point of the segment.
bool operator==(const GfRay &r) const
Component-wise equality test.
GF_API bool Intersect(const GfRange3d &box, double *enterDistance=NULL, double *exitDistance=NULL) const
Intersects the ray with an axis-aligned box, returning true if the ray intersects it at all within bo...
GF_API bool Intersect(const GfBBox3d &box, double *enterDistance=NULL, double *exitDistance=NULL) const
Intersects the ray with an oriented box, returning true if the ray intersects it at all within bounds...
GF_API bool Intersect(const GfVec3d ¢er, double radius, double *enterDistance=NULL, double *exitDistance=NULL) const
Intersects the ray with a sphere, returning true if the ray intersects it at all within bounds.
GF_API void SetEnds(const GfVec3d &startPoint, const GfVec3d &endPoint)
Sets the ray by specifying a starting point and an ending point.
GF_API bool Intersect(const GfVec3d &p0, const GfVec3d &p1, const GfVec3d &p2, double *distance=NULL, GfVec3d *barycentricCoords=NULL, bool *frontFacing=NULL, double maxDist=std::numeric_limits< double >::infinity()) const
Intersects the ray with the triangle formed by points p0, p1, and p2, returning true if it hits.
GF_API friend bool GfFindClosestPoints(const GfRay &, const GfLineSeg &, GfVec3d *, GfVec3d *, double *, double *)
Computes the closest points between a ray and a line segment.
Basic type for a vector of 3 double components.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
GF_API bool GfFindClosestPoints(const GfRay &ray, const GfLine &line, GfVec3d *rayPoint=nullptr, GfVec3d *linePoint=nullptr, double *rayDistance=nullptr, double *lineDistance=nullptr)
Computes the closest points between a ray and a line.