Ray is a line with a start point. More...
Public Member Functions | |
Ray () | |
Constructor. | |
Ray (const Ray &ray) | |
Copy Constructor. | |
Ray (const Vec3 &origin, const Vec3 &direction) | |
Constructs a new ray initialized to the specified origin and direction. More... | |
~Ray () | |
Destructor. | |
bool | intersects (const AABB &aabb, float *distance=nullptr) const |
Check whether this ray intersects with the specified AABB. More... | |
local | intersects ( local aabb, local nullptr) |
Check whether this ray intersects with the specified AABB. More... | |
bool | intersects (const OBB &obb, float *distance=nullptr) const |
Check whether this ray intersects with the specified OBB. More... | |
float | dist (const Plane &plane) const |
Get the distance to the plane. More... | |
Vec3 | intersects (const Plane &plane) const |
Check whether this ray intersects with the specified Plane. More... | |
void | set (const Vec3 &origin, const Vec3 &direction) |
Sets this ray to the specified origin and direction. More... | |
local | set ( local origin, local direction) |
Sets this ray to the specified origin and direction. More... | |
void | transform (const Mat4 &matrix) |
Transforms this ray by the given transformation matrix. More... | |
local | transform ( local matrix) |
Transforms this ray by the given transformation matrix. More... | |
Public Attributes | |
Vec3 | _origin |
The ray origin position. | |
local | _origin |
The ray origin position. | |
Vec3 | _direction |
The ray direction vector. | |
local | _direction |
The ray direction vector. | |
Ray is a line with a start point.
usually use it to check intersects with some object,such as Plane, OBB, AABB
Constructs a new ray initialized to the specified origin and direction.
The ray's origin. The ray's direction.
local new | ( | local | origin, |
local | direction | ||
) |
Constructs a new ray initialized to the specified origin and direction.
The ray's origin. The ray's direction.
bool intersects | ( | const AABB & | aabb, |
float * | distance = nullptr |
||
) | const |
local intersects | ( | local | aabb, |
local | distance = nullptr |
||
) |
bool intersects | ( | const OBB & | obb, |
float * | distance = nullptr |
||
) | const |
local intersects | ( | local | obb, |
local | distance = nullptr |
||
) |
float dist | ( | const Plane & | plane | ) | const |
Get the distance to the plane.
The specified plane. The distance to the plane.
local dist | ( | local | plane | ) |
Get the distance to the plane.
The specified plane. The distance to the plane.
local intersects | ( | local | plane | ) |
Sets this ray to the specified origin and direction.
The ray's origin. The ray's direction.
local set | ( | local | origin, |
local | direction | ||
) |
Sets this ray to the specified origin and direction.
The ray's origin. The ray's direction.
void transform | ( | const Mat4 & | matrix | ) |
Transforms this ray by the given transformation matrix.
The transformation matrix to transform by.
local transform | ( | local | matrix | ) |
Transforms this ray by the given transformation matrix.
The transformation matrix to transform by.