Convert globals uuid and quaternion to tables, to match vector's implementation#30
Merged
HaroldCindy merged 5 commits intosecondlife:mainfrom Dec 16, 2025
Conversation
…ementation Signed-off-by: WolfGangS <flamin2k8@gmail.com>
Signed-off-by: WolfGangS <flamin2k8@gmail.com>
HaroldCindy
requested changes
Dec 14, 2025
HaroldCindy
reviewed
Dec 14, 2025
Signed-off-by: WolfGangS <flamin2k8@gmail.com>
HaroldCindy
requested changes
Dec 15, 2025
Contributor
HaroldCindy
left a comment
There was a problem hiding this comment.
Generally looks pretty good! Just one question about the SLERP stuff.
…ife viewers slerp function Signed-off-by: WolfGangS <flamin2k8@gmail.com>
Signed-off-by: WolfGangS <flamin2k8@gmail.com>
HaroldCindy
approved these changes
Dec 16, 2025
Contributor
HaroldCindy
left a comment
There was a problem hiding this comment.
Thanks! I'll get this out with the next release.
| float invNorm = 1.0f / sqrtf(quaternion_dot(quat, quat)); | ||
| luaSL_pushquaternion(L, quat[0] * invNorm, quat[1] * invNorm, quat[2] * invNorm, quat[3] * invNorm); | ||
| return 1; | ||
| } |
There was a problem hiding this comment.
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
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes globals
uuid, quaternion, rotationto tables with__callmeta method to preserve previous function like behavior for creating uuid's and quaternion'sAll tables contain a
createmethod to follow teh same pattern that the vector table implements.quaternion, rotationalso containnormalize-(quat: quaternion) -> quaternionmagnitude-(quat: quaternion) -> numberdot-(quat1: quaternion, quat2: quaternion) -> numberslerp-(start: quaternion, target: quaternion, interpolation: number) -> quaternionconjugate-(quat: quaternion) -> quaterniontofwd-(quat: quaternion) -> vectortoleft-(quat: quaternion) -> vectortoright-(quat: quaternion) -> vectorMethods useful for working with quaternions.
Originally there was also an intent to add
toeulerandfromeulerhowever as i could not find a way to implement them and match the output of LSL'sllEuler2Rotexactly, this has been left out for now, for addition later, after either it's been decided if matching them exactly is needed or not, and if so someone with access to teh reference implementation might need to do it.Personally looking at some of the various implementations I've seen, I'm not sure slua's implementation needs to match
ll.Euler2Rotexactly, as that is still available if someone needed exact value matching. A "simpler" implementation could be used, as long as it provides expected results.Update
A set of basic quaternion tests for lua have been added