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

Alternative to len #70

Open
mantielero opened this issue Oct 7, 2023 · 2 comments
Open

Alternative to len #70

mantielero opened this issue Oct 7, 2023 · 2 comments

Comments

@mantielero
Copy link

Sorry for this probably naive question. I was trying the following:

import vmath
var a = vec2(10.0,2.0)
echo a.len

This works if compiled with -d:vmathArrayBased, but how can I get the length of the vector when is not based in arrays?

@treeform
Copy link
Owner

You can use the length() function to get the magnitude:
https://registry.khronos.org/OpenGL-Refpages/gl4/html/length.xhtml

Or do want to get how many dementions the vector has? In this case 2 because its a vec2?

@mantielero
Copy link
Author

Yes, I meant getting the vector dimension (2 for Vec2). I think it would make sense having an equivalent len for the cases where is not compiled with -d:vmathArrayBased.

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