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

Some new additions, some leaner implementations and one breaking change(!) #35

Merged
merged 4 commits into from
May 2, 2024

Conversation

chran554
Copy link
Contributor

@chran554 chran554 commented Apr 4, 2022

Breaking change(!) cross function vec2 (float32 float64) now return a scalar value, not a new vector.
Cross-product in 2D is not well-defined but it is changed to the 2D version stated at https://mathworld.wolfram.com/CrossProduct.html .

Add Sinus and Cosine for angle between vectors (vec2 vec3 float64 float32)
Changed implementation for Angle (vec2 vec3 float32 float64) to utilize Cosine implementation (with math.Acos).
Changed implementation for left and right winding (vec2 float32 float64)

Duplicated test file for quaternion (float32 float64)

…alue, not a new vector. Cross-product in 2D is not well-defined but it is changed to the 2D version stated at https://mathworld.wolfram.com/CrossProduct.html .

Add Sinus and Cosine for angle between vectors (vec2 vec3 float64 float32)
Changed implementation for Angle (vec2 vec3 float32 float64) to utilize Cosine implementation (with math.Acos).
Changed implementation for left and right winding (vec2 float32 float64)

Duplicated test file for quaternion (float32 float64)
@ungerik
Copy link
Owner

ungerik commented Apr 4, 2022

Thanks, a little bit more to review :-)

@chran554
Copy link
Contributor Author

Do you have any thoughts or considerations?
Can I be of assistance?

@ungerik
Copy link
Owner

ungerik commented Apr 27, 2022 via email

@chran554
Copy link
Contributor Author

chran554 commented Jun 7, 2022

ping... :-P

@ungerik
Copy link
Owner

ungerik commented May 1, 2024

TestQuaternionRotateVec3 is failing

@chran554
Copy link
Contributor Author

chran554 commented May 2, 2024

TestQuaternionRotateVec3 is failing

Yes, indeed it does. I do not remember them failing when I ran the tests previously. I found out that IntelliJ Idea run the tests with success if you run them in debug mode (but fail in normal run mode). (!?)
However, they also fail when running at the command line.

The tests fail because there is a slight difference in the last decimal between the "expected" and "actual" rotated result vector.
I can not trace the error to any of my current (or previous) changes, the rotation that fail only use pretty basic functions.

The same error occur in the master branch.
Try to add this testlogging to the master branch and run the Quaternion test file (float32 version).
Add_test_fail_logging.patch

go test ./...

--- FAIL: TestQuaternionRotateVec3 (0.00s)
    quaternion_test.go:57: test case [-90 0 0] rotates [1 3 -2] failed - rotation: [1 -1.9999999999999996 -3.0000000000000004], [1 -1.9999999999999993 -3.0000000000000004]
    quaternion_test.go:57: test case [28 1043 -38] rotates [1 3 -2] failed - rotation: [2.673166962482776 2.4826629020490287 0.8310013871709876], [2.673166962482776 2.4826629020490283 0.8310013871709876]
    quaternion_test.go:57: test case [90 20 21] rotates [-6 2 9] failed - rotation: [-6.033990983812915 -9.000000000000002 1.8949809516890814], [-6.033990983812915 -9.000000000000002 1.8949809516890816]

@chran554
Copy link
Contributor Author

chran554 commented May 2, 2024

Added a fix for the tests. See the diff in commit above if it is appropriate.
fix quaternion tests. They were failing due to precision errors in float values

Copy link
Owner

@ungerik ungerik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ungerik ungerik merged commit 1137f6a into ungerik:master May 2, 2024
2 of 3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants