Ray

Inherited: None

Description

Ray is an infinity line starting from position pos and going to some direction

Public Methods

Ray (const Vector3 & position, const Vector3 & direction)

Ray ()

Ray

diffuse (const Vector3 & normal, const Vector3 & point, areal min, areal max)

bool

intersect (const Vector3 & position, areal radius, Ray::Hit * hit)

bool

intersect (const Plane & plane, Ray::Hit * hit, bool back = false)

bool

intersect (const AABBox & box, Ray::Hit * hit)

bool

intersect (const Vector3 & v1, const Vector3 & v2, const Vector3 & v3, Ray::Hit * hit, bool back = false)

Ray

reflect (const Vector3 & normal, const Vector3 & point)

Ray

refract (const Vector3 & normal, const Vector3 & point, areal ior)

bool

operator!= (const Ray & ray) const

bool

operator== (const Ray & ray) const

Static Methods

None

Methods Description

Ray::Ray (Vector3 & position, Vector3 & direction)

Constructs a ray with position and direction.


Ray::Ray ()

Constructs an identity ray. pos at [0, 0, 0] and dir to [0, 0, 1]


Ray Ray::diffuse (Vector3 & normal, Vector3 & point, areal min, areal max)

Returns a new Ray object which result of random directed reflection of current ray. Diffuse reflection calculating by normal vector of reflection surface and intersection point. With min and max constraints.


bool Ray::intersect (Vector3 & position, areal radius, Ray::Hit * hit)

Returns true if this ray intersects the given sphere at position and radius; otherwise returns false. Output argument hit contain a hit data.


bool Ray::intersect (Plane & plane, Ray::Hit * hit, bool back = false)

Returns true if this ray intersects the given plane; otherwise returns false. Output argument hit contain a hit data. Argument back is a flag to ignore *back*face culling.


bool Ray::intersect (AABBox & box, Ray::Hit * hit)

Returns true if this ray intersects the given Axis Aligned Bounding box; otherwise returns false. Output argument hit contain a hit data.


bool Ray::intersect (Vector3 & v1, Vector3 & v2, Vector3 & v3, Ray::Hit * hit, bool back = false)

Returns true if this ray intersects the given triangle between v1, v2 and v3 points; otherwise returns false. Output argument hit contain a hit data. Argument back is a flag to use *back*face culling.


Ray Ray::reflect (Vector3 & normal, Vector3 & point)

Returns a new Ray object which result of reflection of current ray. Reflection calculating by normal vector of reflection surface and intersection point.


Ray Ray::refract (Vector3 & normal, Vector3 & point, areal ior)

Returns a new Ray object which result of refraction of current ray. Refraction calculating by normal vector of reflection surface and intersection point with ior (Index of Refraction).


bool Ray::operator!= (Ray & ray) const

Returns true if this ray is NOT equal to given ray; otherwise returns false. This operator uses an exact floating-point comparison.


bool Ray::operator== (Ray & ray) const

Returns true if this ray is equal to given ray; otherwise returns false. This operator uses an exact floating-point comparison.