U3D
Open-source, cross-platform 2D and 3D game engine built in C++
Loading...
Searching...
No Matches
Urho3D::Ray Class Reference

#include </var/dev/u3d/stable/Source/Urho3D/Math/Ray.h>

Collaboration diagram for Urho3D::Ray:
[legend]

Public Member Functions

 Ray () noexcept=default
 Construct a degenerate ray with zero origin and direction.
 
 Ray (const Vector3 &origin, const Vector3 &direction) noexcept
 Construct from origin and direction. The direction will be normalized.
 
 Ray (const Ray &ray) noexcept=default
 Copy-construct from another ray.
 
Rayoperator= (const Ray &rhs) noexcept=default
 Assign from another ray.
 
bool operator== (const Ray &rhs) const
 Check for equality with another ray.
 
bool operator!= (const Ray &rhs) const
 Check for inequality with another ray.
 
void Define (const Vector3 &origin, const Vector3 &direction)
 Define from origin and direction. The direction will be normalized.
 
Vector3 Project (const Vector3 &point) const
 Project a point on the ray.
 
float Distance (const Vector3 &point) const
 Return distance of a point from the ray.
 
Vector3 ClosestPoint (const Ray &ray) const
 Return closest point to another ray.
 
float HitDistance (const Plane &plane) const
 Return hit distance to a plane, or infinity if no hit.
 
float HitDistance (const BoundingBox &box) const
 Return hit distance to a bounding box, or infinity if no hit.
 
float HitDistance (const Frustum &frustum, bool solidInside=true) const
 Return hit distance to a frustum, or infinity if no hit. If solidInside parameter is true (default) rays originating from inside return zero distance, otherwise the distance to the closest plane.
 
float HitDistance (const Sphere &sphere) const
 Return hit distance to a sphere, or infinity if no hit.
 
float HitDistance (const Vector3 &v0, const Vector3 &v1, const Vector3 &v2, Vector3 *outNormal=nullptr, Vector3 *outBary=nullptr) const
 Return hit distance to a triangle, or infinity if no hit. Optionally return hit normal and hit barycentric coordinate at intersect point.
 
float HitDistance (const void *vertexData, unsigned vertexStride, unsigned vertexStart, unsigned vertexCount, Vector3 *outNormal=nullptr, Vector2 *outUV=nullptr, unsigned uvOffset=0) const
 Return hit distance to non-indexed geometry data, or infinity if no hit. Optionally return hit normal and hit uv coordinates at intersect point.
 
float HitDistance (const void *vertexData, unsigned vertexStride, const void *indexData, unsigned indexSize, unsigned indexStart, unsigned indexCount, Vector3 *outNormal=nullptr, Vector2 *outUV=nullptr, unsigned uvOffset=0) const
 Return hit distance to indexed geometry data, or infinity if no hit. Optionally return hit normal and hit uv coordinates at intersect point.
 
bool InsideGeometry (const void *vertexData, unsigned vertexSize, unsigned vertexStart, unsigned vertexCount) const
 Return whether ray is inside non-indexed geometry.
 
bool InsideGeometry (const void *vertexData, unsigned vertexSize, const void *indexData, unsigned indexSize, unsigned indexStart, unsigned indexCount) const
 Return whether ray is inside indexed geometry.
 
Ray Transformed (const Matrix3x4 &transform) const
 Return transformed by a 3x4 matrix. This may result in a non-normalized direction.
 

Public Attributes

Vector3 origin_
 Ray origin.
 
Vector3 direction_
 Ray direction.
 

Detailed Description

Infinite straight line in three-dimensional space.


The documentation for this class was generated from the following files: