   Closest line segment point with no square root
  Recently I was given a coding test to calculate the point on a line segment that is closest to a given input point.  I was asked to try and make it as efficient as possible and avoid making any calls that will use a square root operation.I know how  to solve this problem by using the square root operation.  However, I could not think of a way to solve the problem with out use computing the square root.What do people know about how this problem can be solved?   
  When I write it out in the intuitive way, with a normalized direction vector, that normalized vector is used twice: once in a dot product, and once in a scalar/vector product. To normalize that vector, you of course divide it by its length, but because you're doing that division twice, you could also just divide by its square length only once, which means you wouldn't need the sqrt any more.   ;Quote:Vector closestPointOnSegment(const Vector& point, const Vector& start, const Vector& end){    Vector delta = (point - start);    Vector edge = (end - start);    float t = delta.dotProduct(edge) / edge.dotProduct(edge);    if(t < 0.0f)    t = 0.0f;else if (t > 1.0f)    t = 1.0f;    return start + edge * t;}