You.i Engine
CYIRay Class Reference

Detailed Description

Encapsulates the origin and direction points of a ray.

This class can be used to describe a pick ray. When a CYIActionEvent occurs the CYISceneManager method CreatePickRay will populate this class with the vectors describing the action based on the location of the camera and view port.

Resulting collisions vectors are intersection between the ray and another element. The CYIRay is used with CYIAABB (Axis Aligned Bounding Box) but not limited to that scenario.

See also

The collision detection function should be ready to handle one ore more of m_unit components sets to 0.0. This would result in having a component of m_oneOverUnit set to +/- INF.

See also

#include <event/YiRay.h>

Public Member Functions

 CYIRay ()
 CYIRay (const glm::vec3 &start, const glm::vec3 &end)
void Create (const glm::vec3 &start, const glm::vec3 &end)
CYIRay Transform (const glm::mat4 &matrix) const
const glm::vec3 & GetOrigin () const
const glm::vec3 & GetUnit () const
const glm::vec3 & GetOneOverUnit () const

Constructor & Destructor Documentation

◆ CYIRay() [1/2]

CYIRay::CYIRay ( )

◆ CYIRay() [2/2]

CYIRay::CYIRay ( const glm::vec3 &  start,
const glm::vec3 &  end 

Member Function Documentation

◆ Create()

void CYIRay::Create ( const glm::vec3 &  start,
const glm::vec3 &  end 

Creates a ray pointing from start to end.

◆ GetOneOverUnit()

const glm::vec3 & CYIRay::GetOneOverUnit ( ) const

Returns the local space collision vector which is (1.0 / unit vector). It is used for the intersection function optimisation.

◆ GetOrigin()

const glm::vec3 & CYIRay::GetOrigin ( ) const

Returns the origin vector.

◆ GetUnit()

const glm::vec3 & CYIRay::GetUnit ( ) const

Returns the unit vector.

◆ Transform()

CYIRay CYIRay::Transform ( const glm::mat4 &  matrix) const

Returns a transformed copy of this ray.

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