glm vector distanceSquare

Hi,

can I get from glm somethin like squareDistance of 2 vectors?

I just want to do some distance comparisons, so no need to calculate sqrt.

Thank you!

I don’t think there’s a specific function for it, but the code is pretty trivial. Where A and B are of type glm::vec3:


glm::vec3 temp = A - B;
float distSqr = dot(temp, temp);

oh, how easy, how can I missed it…

Thank you very much!