You have to return lineFrom + r instead of just r. Apart from this the code is correct (unless you try to find the closest point on line segment, not the infinite line - in the former case you should clamp the value w to be in range [0; l] to correctly handle the endpoints).
these are just standards... standards i dont conform to. dont people like u get bored of pointless posts like this?
I don't do 'pointless posts'. This one was trivial, hence the introductory
My 1 cent worth:
. Even though I sometimes post things that are trivial, it might still be of help to someone because people often miss small things.
these are just standards... standards i dont conform to.
This tells me that you have misunderstood what my post was about. Here is what I meant in more detail:
You had Vector v (lowercase v), then on the following line the function call dotProduct(u, V); (upper case V). I couldn't see a declaration of Vector V anywhere. If V was declared elsewhere - that's fine, but still it's a reasonable reason for me to make my post.
The other thing was Vector(v1.x * v2.X - again the mixed case of member variable x or X. Presumeably Vector is declared with X, Y, Z as member variables, so I am saying that v1.x might be an error.