-
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
Convert globals uuid and quaternion to tables, to match vector's implementation #30
Conversation
…ementation Signed-off-by: WolfGangS <flamin2k8@gmail.com>
Signed-off-by: WolfGangS <flamin2k8@gmail.com>
Signed-off-by: WolfGangS <flamin2k8@gmail.com>
HaroldCindy
left a comment
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.
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
left a comment
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.
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.
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!
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