Skip to content
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

Closed
plasmacel opened this issue Oct 13, 2015 · 0 comments
Closed

length and length2 overloads for scalar types #431

plasmacel opened this issue Oct 13, 2015 · 0 comments
Assignees

Comments

@plasmacel
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants