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

Add element-wise abs() #477

Open
swiftcoder opened this issue Feb 9, 2019 · 2 comments
Open

Add element-wise abs() #477

swiftcoder opened this issue Feb 9, 2019 · 2 comments

Comments

@swiftcoder
Copy link

swiftcoder commented Feb 9, 2019

Taking the element-wise absolute value of a vector is a pretty common operation in GLSL. It would be lovely to have an abs_element_wise().

Maybe also a .abs() added to VectorSpace for consistency with numeric types.

@Osspial
Copy link
Collaborator

Osspial commented Feb 9, 2019

You should be able to accomplish this with {vector/point}.map(|n| n.abs()).

@swiftcoder
Copy link
Author

That is how I'm accomplishing this currently, but from my perspective it's a sufficiently common operation that it'd be nice to have it in the main API.

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

No branches or pull requests

2 participants