-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Angle() function #5
Comments
I agree, it would be very useful. Your welcome to take a crack at it! It is important that the solution works with both 2D and 3D vectors. The API could look something like the example below? angle, err := vector.Angle(v1, v2)
// and
angle, err := v1.Angle(v2) |
Also fixing Vector.Cross(), because the function's formula was incorrect (double-checked using https://www.vcalc.com/wiki/vCalc/V3+-+V+x+U and https://www.omnicalculator.com/math/cross-product).
Adding the Angle() function via PR. My proposed Angle() function returns the vector of rotation to get the angle from one vector to another, as well; seems like it might be good for Vector.Rotate() to take Vectors to rotate by, rather than being fixed axes. |
Also fixing Vector.Cross(), because the function's formula was incorrect (double-checked using https://www.vcalc.com/wiki/vCalc/V3+-+V+x+U and https://www.omnicalculator.com/math/cross-product).
Updated with a slight improvement to the verbage of the docs for the Angle() function. |
This is a great idea! Will look into that. |
* #5 - Adding Angle() function. Also fixing Vector.Cross(), because the function's formula was incorrect (double-checked using https://www.vcalc.com/wiki/vCalc/V3+-+V+x+U and https://www.omnicalculator.com/math/cross-product). * Taking out vector of rotation from Angle(). Not really useful until Vector.Rotate() takes arbitrary Vectors. Fixing tests, adding benchmark. Co-authored-by: Frederik Kvartborg Albertsen <[email protected]>
Hello!
A function to return the angle between two Vectors would be highly useful, particularly in 2D; any plans to add this? I'm not too hot on my math, but I can take a crack at it if you'd find it useful.
The text was updated successfully, but these errors were encountered: