CUGL 2.3
Cornell University Game Library
|
#include <CURay.h>
Public Member Functions | |
Ray () | |
Ray (const Vec3 direction) | |
Ray (const Vec3 origin, const Vec3 direction) | |
Ray (const Ray &ray) | |
~Ray () | |
Ray & | operator= (const Ray &ray) |
Ray & | operator= (const Vec3 direction) |
Ray & | set (const Ray &ray) |
Ray & | set (const Vec3 origin, const Vec3 direction) |
Ray & | set (const Vec3 direction) |
Vec3 | getEndpoint (float distance) const |
Ray & | multiply (const Mat4 &mat) |
Ray & | operator*= (const Mat4 &mat) |
Vec3 | operator* (float distance) const |
const Ray | operator* (const Mat4 &mat) const |
bool | operator== (const Ray &r) const |
bool | operator!= (const Ray &r) const |
bool | equals (const Ray &r, float variance=CU_MATH_EPSILON) const |
std::string | toString (bool verbose=false) const |
operator std::string () const | |
Static Public Member Functions | |
static Vec3 * | endpoint (const Ray &ray, float distance, Vec3 *dst) |
static Ray * | multiply (const Ray &ray, const Mat4 &mat, Ray *dst) |
Public Attributes | |
Vec3 | origin |
Vec3 | direction |
Static Public Attributes | |
static const Ray | X_AXIS |
static const Ray | Y_AXIS |
static const Ray | Z_AXIS |
This class is a ray with a starting position and a unit length direction.
While this class has a few convience methods, most of the access is intended to be through the individual attributes.
|
inline |
Creates a new ray along the x-axis
|
inline |
Creates a new ray with the given direction.
The origin of the ray is (0,0,0)
direction | The ray direction |
Creates a new ray with the given origin and the direction.
origin | The starting position |
direction | The ray direction |
|
inline |
Creates a copy of the given ray.
ray | The ray to copy |
|
inline |
Destroys this ray, releasing all resources
Computes the endpoint for the given distance and assigns it to dst.
This is calculated as startpoint + distance * direction.
ray | The ray to calculate |
distance | The distance value |
dst | A vector to store the result in |
|
inline |
Returns true if the rays are within tolerance of each other.
The tolerance bounds the origin and direction separately.
r | The ray to compare against. |
variance | The comparison tolerance. |
|
inline |
Returns the endpoint for the given distance.
This is calculated as startpoint + distance * direction.
distance | The distance value |
Multiplies this ray by the given matrix.
Use this to transform the ray into another coordinate system.
mat | The transform matrix |
Multiplies the ray by the given matrix and assigns it to dst.
Use this to transform a ray into another coordinate system.
ray | The ray to transform |
mat | The transform matrix |
dst | A ray to store the result in |
|
inline |
Cast from Ray to a string.
|
inline |
Returns true if this ray is not equal to the given ray.
Comparison is exact, which may be unreliable given that the attributes are floats.
r | The ray to compare against. |
Returns a copy of this ray multiplied by the given matrix.
Use this to transform the ray into another coordinate system.
mat | The transform matrix |
|
inline |
Returns the endpoint for the given distance.
This is calculated as startpoint + distance * direction.
distance | The distance value |
Multiplies this ray by the given matrix.
Use this to transform the ray into another coordinate system.
mat | The transform matrix |
Sets this ray to be a copy of the given ray.
ray | The ray to copy |
Sets this ray to go along the given direction from the origin.
This will reset the origin to (0,0,0).
direction | The ray direction |
|
inline |
Returns true if this ray is equal to the given ray.
Comparison is exact, which may be unreliable given that the attributes are floats.
r | The ray to compare against. |
Sets this ray to be a copy of the given ray.
ray | The ray to copy |
Sets this ray to go along the given direction from the origin.
This will reset the origin to (0,0,0).
direction | The ray direction |
Sets this ray to have the given origin and the direction.
origin | The starting position |
direction | The ray direction |
std::string cugl::Ray::toString | ( | bool | verbose = false | ) | const |
Returns a string representation of this ray for debugging purposes.
If verbose is true, the string will include class information. This allows us to unambiguously identify the class.
verbose | Whether to include class information |
Vec3 cugl::Ray::direction |
The direction of this ray (a unit vector)
Vec3 cugl::Ray::origin |
The anchoring origin of this ray.
|
static |
The ray anchored at the origin along the x-axis
|
static |
The ray anchored at the origin along the y-axis
|
static |
The ray anchored at the origin along the z-axis