Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | Namespace Members | Class Members | Related Pages

DistancePointToRay Struct Template Reference
[XEngineMath Library]

List of all members.

Detailed Description

template<unsigned int Dimension>
struct XEngine::Math::DistanceAlgorithms::DistancePointToRay< Dimension >

Returns the distance of the given point to the given ray.

	The ray is parameterized as X = P + t * D where P is a point on the ray,
	t >= 0 and D is the ray direction. Given a point Q we want to
	find the closest distance of Q to the ray X. The closest point on the ray
	to Q is the projection of Q onto the ray, or in other words
		Qproj = P + u * D where u = (D * (Q - P)) / (D * D)
	if u > 0. If u <= 0 however the closest point to Q on the ray is P.
	The distance from Q to the ray is therefore:
		d = |Q - P|                            if u <= 0
		d = |Q - Qproj| = |Q - (P + u * D)|    if u > 0
	


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