I have set of points (3D). What i am doing is getting a line that connect first and last point of data set. Then trying to find index of point that has max distance from line. Just to express my problem Click image for larger version. 

Name:	distance.jpg 
Views:	66 
Size:	6.9 KB 
ID:	2507.

I wrote a function for that which uses Eigen library. Which is as below

Code :
std::vector<Eigen::Vector3f> points; // input set of points
	typedef Eigen::ParametrizedLine<float, 3> Line3;
	static Line3 start_to_end = Line3::Through(points[0], points.back());
	float max_dist_squared = 0.0f;
	size_t max_idx = 0;
	for (size_t i = 0; i<points.size(); ++i) 
		float dist2 = start_to_end.distance(points[i]);
		if (dist2 > max_dist_squared) 
			max_dist_squared = dist2;
			max_idx = i; 
			std::cout << "\n Distance is  " << dist2 << " and i " << i << std::endl;

PROBLEM : I want to write same method using GLM. I mean to ask is any method that help me to find line and distance from a point. Or how can i convert above code Using GLM library.