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

DistancePointToLine Struct Template Reference
[XEngineMath Library]

List of all members.

Detailed Description

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

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

	The line is parameterized as X = P + t * D where P is a point on the line,
	t is a real value and D is the line direction which is not necessarily
	unit-length. Given a point Q we want to find the closest distance of Q to 
	the line X. The closest point on the line to Q is the projection of Q onto 
	the line, or in other words
		Qproj = P + u * D where u = (D * (Q - P)) / (D * D)
	The distance from Q to the line is therefore:
		d = |Q - Qproj| = |Q - (P + u * D)|
	


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