Exemple #1
0
			/// Returns the time on the line where a point is closest to the given point.
			NumericT time_for_closest_point (const VectorT & p3) const {
				auto p1 = _point;
				auto p2 = _point + _direction;

				auto d = _direction.length_squared();
				NumericT t = 0;

				for (dimension i = 0; i < D; ++i)
					t += (p3[i] - p1[i]) * (p2[i] - p1[i]);

				return t / d;
			}