Leviathan  0.8.0.0
Leviathan game engine
Leviathan::Ray Struct Reference

Ray starting from an origin with a direction. More...

#include <Ray.h>

Public Member Functions

 Ray ()
 
 Ray (const Float3 &origin, const Float3 &direction)
 
 Ray (const bs::Ray &bsray)
 
Float3 GetPoint (float distance) const
 
const auto GetOrigin () const
 
const auto GetDirection () const
 
DLLEXPORT std::tuple< bool, float > CalculateIntersection (const Plane &plane) const
 

Public Attributes

Float3 Origin
 
Float3 Direction
 

Detailed Description

Ray starting from an origin with a direction.

Definition at line 14 of file Ray.h.

Constructor & Destructor Documentation

◆ Ray() [1/3]

Leviathan::Ray::Ray ( )
inline

Definition at line 16 of file Ray.h.

16 {}

◆ Ray() [2/3]

Leviathan::Ray::Ray ( const Float3 origin,
const Float3 direction 
)
inline

Definition at line 18 of file Ray.h.

18  :
19  Origin(origin), Direction(direction)
20  {}
Float3 Origin
Definition: Ray.h:47
Float3 Direction
Definition: Ray.h:48

◆ Ray() [3/3]

Leviathan::Ray::Ray ( const bs::Ray &  bsray)
inline

Definition at line 22 of file Ray.h.

22  :
23  Origin(bsray.getOrigin()), Direction(bsray.getDirection())
24  {}
Float3 Origin
Definition: Ray.h:47
Float3 Direction
Definition: Ray.h:48

Member Function Documentation

◆ CalculateIntersection()

DLLEXPORT std::tuple< bool, float > Ray::CalculateIntersection ( const Plane plane) const
Returns
Whether this intersects a plane as well as the distance to the intersection point

Definition at line 8 of file Ray.cpp.

9 {
10  return plane.CalculateIntersection(*this);
11 }
DLLEXPORT std::tuple< bool, float > CalculateIntersection(const Ray &ray) const
Definition: Plane.cpp:8

◆ GetDirection()

const auto Leviathan::Ray::GetDirection ( ) const
inline

Definition at line 37 of file Ray.h.

38  {
39  return Direction;
40  }
Float3 Direction
Definition: Ray.h:48

◆ GetOrigin()

const auto Leviathan::Ray::GetOrigin ( ) const
inline

Definition at line 32 of file Ray.h.

33  {
34  return Origin;
35  }
Float3 Origin
Definition: Ray.h:47

◆ GetPoint()

Float3 Leviathan::Ray::GetPoint ( float  distance) const
inline
Returns
A point along this ray at distance from Origin

Definition at line 27 of file Ray.h.

28  {
29  return Origin + (Direction * distance);
30  }
Float3 Origin
Definition: Ray.h:47
Float3 Direction
Definition: Ray.h:48
std::iterator_traits< octet_iterator >::difference_type distance(octet_iterator first, octet_iterator last)
Definition: checked.h:198

Member Data Documentation

◆ Direction

Float3 Leviathan::Ray::Direction

Definition at line 48 of file Ray.h.

◆ Origin

Float3 Leviathan::Ray::Origin

Definition at line 47 of file Ray.h.


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