forked from icaven/glm
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
length and length2 overloads for scalar types #431
Labels
Comments
Groovounet
added a commit
that referenced
this issue
Jun 4, 2016
Groovounet
added a commit
that referenced
this issue
Jul 14, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In many situations template functions involve length or squared length computations on the input values. For example the centripetal and chordal Catmull-Rom spline variants involve length and squared length computations on the control points. If you interpolate between multidimensional points (vec2, vec3, vec4) then everything is fine, however when you interpolate between scalar values glm lacks the support. The only way to solve this now is creating SFINAE function/class overloads for vector and non-vector types (where you calculate length on vector types and absolute value on scalar types), however with scalar glm::length() and glm::length2() the issue could be solved without additional effort or metaprogramming. Of course a scalar length is just an absolute value, and length2 is just a square, yet these variants can be very helpful. It is also makes sense because the geometric length function is just a specialized case of the generalized term magnitude.
The text was updated successfully, but these errors were encountered: