-
Notifications
You must be signed in to change notification settings - Fork 5
Convert globals uuid and quaternion to tables, to match vector's implementation #30
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
Merged
HaroldCindy
merged 5 commits into
secondlife:main
from
WolfGangS:feature/uuid-quaternion-tables
Dec 16, 2025
+279
−16
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7c876e4
Convery globals uuid and quaternion to tables, to match vector's impl…
WolfGangS c77562f
Add quaternion tests
WolfGangS 0488d59
Review fixes: tests and normalize to... functions
WolfGangS 34fbe3d
Review fixes: Change slerp to use the same methodology as the secondl…
WolfGangS bce1bbd
remove pointless extra variable
WolfGangS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| local quat = give_quaternion() | ||
| local yaw_ninety = quaternion(0,0,0.7071068,0.7071068) | ||
|
|
||
| assert(quat == quaternion(1, 2, 3, 4)) | ||
|
|
||
| -- Test string cast is expected format and precision | ||
| assert(`{quat}` == "<1, 2, 3, 4>") | ||
| assert(`{yaw_ninety}` == "<0, 0, 0.707107, 0.707107>") | ||
|
|
||
| -- Test both quaternion and rotation modules exist and can be used for creation the same way | ||
| assert(quaternion(1, 2, 3, 4) == quaternion(1, 2, 3, 4)) | ||
| assert(quaternion.create(4, 3, 2, 1) == rotation.create(4, 3, 2, 1)) | ||
|
|
||
| -- Test quaternion module functions | ||
| assert(quaternion.normalize(quaternion(3, 5, 2, 1)) == quaternion(0.4803844690322876, 0.8006408214569092, 0.3202563226222992, 0.1601281613111496)) | ||
|
|
||
| assert(quaternion.magnitude(quaternion(0, 0, 0, 1)) == 1) | ||
|
|
||
| assert(quaternion.dot(quaternion(1, 2, 3, 4),quaternion(0, 0, 0, 1)) == 4) | ||
|
|
||
| assert(quaternion.conjugate(quat) == quaternion(-quat.x, -quat.y, -quat.z, quat.s)) | ||
|
|
||
| assert(`{quaternion.slerp(yaw_ninety, quaternion(0, 0, 0, 1), 0.5)}` == "<0, 0, 0.382683, 0.92388>") | ||
|
|
||
| -- string cast to deal with precision | ||
| assert(`{quaternion.tofwd(yaw_ninety)}` == "<0, 1, 0>") | ||
| assert(`{quaternion.toleft(yaw_ninety)}` == "<-1, 0, 0>") | ||
| assert(`{quaternion.toup(yaw_ninety)}` == "<0, 0, 1>") | ||
|
|
||
| -- Check rotation module has same implementation as quaternion module | ||
| for k,_ in quaternion do | ||
| assert(rotation[k] ~= nil) | ||
| end | ||
|
|
||
| return "OK" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it miss normalize( quaternion( 0, 0, 0, 0 ) ) ?
this one checks for it: https://github.com/secondlife/viewer/blob/f4eec813a3043e2277ae62da6a829c65887d0785/indra/llmath/llquaternion.h#L504-L535
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3d26304 thanks!