Ocular Engine
|
#include <Ray.hpp>
Public Member Functions | |
Ray (Vector3f const &origin, Vector3f const &direction) | |
void | setOrigin (Vector3f const &origin) |
void | setDirection (Vector3f const &direction) |
Vector3f const & | getOrigin () const |
Vector3f const & | getDirection () const |
Vector3f | getPointAlong (float distance) const |
bool | intersects (Point3f const &point) const |
bool | intersects (Ray const &other) const |
bool | intersects (Ray const &other, Point3f &point, float &distance) const |
bool | intersects (BoundsSphere const &bounds) const |
bool | intersects (BoundsSphere const &bounds, Point3f &point, float &distance) const |
bool | intersects (BoundsAABB const &bounds) const |
bool | intersects (BoundsAABB const &bounds, Point3f &point, float &distance) const |
bool | intersects (BoundsOBB const &bounds) const |
bool | intersects (BoundsOBB const &bounds, Point3f &point, float &distance) const |
bool | intersects (Plane const &plane) const |
bool | intersects (Plane const &plane, Vector3f &point, float &distance) const |
An infinite line that has an origin and direction.
Creates a ray with the specified origin and direction.
[in] | origin | |
[in] | direction | Normalized vector direction. |
Vector3f const & Ocular::Math::Ray::getDirection | ( | ) | const |
Returns the normalized direction of the ray.
Vector3f const & Ocular::Math::Ray::getOrigin | ( | ) | const |
Returns the origin of the ray.
Vector3f Ocular::Math::Ray::getPointAlong | ( | float | distance | ) | const |
Returns the point that lies the given distance along the ray
bool Ocular::Math::Ray::intersects | ( | Point3f const & | point | ) | const |
Performs an intersection test on a ray and point.
[in] | point |
bool Ocular::Math::Ray::intersects | ( | Ray const & | other | ) | const |
Performs an intersection test on two rays.
[in] | other |
Performs an intersection test on two rays.
[in] | other | |
[out] | point | The point that the rays intersect, if they intersect. |
[out] | distance | The distance from the ray origin to the point of intersection |
bool Ocular::Math::Ray::intersects | ( | BoundsSphere const & | bounds | ) | const |
Performs an intersection test on a ray and bounding sphere.
[in] | bounds |
bool Ocular::Math::Ray::intersects | ( | BoundsSphere const & | bounds, |
Point3f & | point, | ||
float & | distance | ||
) | const |
Performs an intersection test on a ray and bounding sphere.
This version of the method also returns the point at which the two intersect. If speed is of the uptmost concern and/or the exact point of intersection is not required, then the other version may be used instead.
[in] | bounds | |
[out] | point | The point that the ray and bounding sphere intersects. |
[out] | distance | The distance from the ray origin to the point of intersection |
bool Ocular::Math::Ray::intersects | ( | BoundsAABB const & | bounds | ) | const |
Performs an intersection test on a ray and AABB.
[in] | bounds |
bool Ocular::Math::Ray::intersects | ( | BoundsAABB const & | bounds, |
Point3f & | point, | ||
float & | distance | ||
) | const |
Performs an intersection test on a ray and AABB.
This version of the method also returns the point at which the two intersect. If speed is of the uptmost concern and/or the exact point of intersection is not required, then the other version may be used instead.
[in] | bounds | |
[out] | point | The point that the ray and AABB intersect, if they intersect. |
[out] | distance | The distance from the ray origin to the point of intersection |
bool Ocular::Math::Ray::intersects | ( | BoundsOBB const & | bounds | ) | const |
Performs an intersection test on a ray and OBB.
[in] | bounds |
bool Ocular::Math::Ray::intersects | ( | BoundsOBB const & | bounds, |
Point3f & | point, | ||
float & | distance | ||
) | const |
Performs an intersection test on a ray and OBB.
This version of the method also returns the point at which the two intersect. If speed is of the uptmost concern and/or the exact point of intersection is not required, then the other version may be used instead.
[in] | bounds | |
[out] | point | The point that the ray and OBB intersect, if they intersect. |
[out] | distance | The distance from the ray origin to the point of intersection |
bool Ocular::Math::Ray::intersects | ( | Plane const & | plane | ) | const |
Performs an intersection test on a ray and plane.
Note that this operation is actually a line-plane intersection. The line begins at ray origin and extends RAY_LINE_LENGTH.
[in] | plane |
bool Ocular::Math::Ray::intersects | ( | Plane const & | plane, |
Vector3f & | point, | ||
float & | distance | ||
) | const |
Performs an intersection test on a ray and plane.
Note that this operation is actually a line-plane intersection. The line begins at ray origin and extends RAY_LINE_LENGTH.
[in] | plane | |
[out] | point | The point that the ray and AABB intersect, if they intersect. |
[out] | distance | The distance from the ray origin to the point of intersection |
void Ocular::Math::Ray::setDirection | ( | Vector3f const & | direction | ) |
Sets the normalized direction of the ray.
void Ocular::Math::Ray::setOrigin | ( | Vector3f const & | origin | ) |
Sets the origin of the ray.