raysan5
Ray
47 posts
/ 1 project
I love videogames development. 
#12589
raymath  a simple 3d math library 1 year, 7 months ago Edited by Ray on July 22, 2017, 11:30 a.m.
raymath v1.1
Well, actually I created this simple 3d math library for raylib 1.0 about 4 years ago. As many other raylib modules it can be used as an standalone library. Lately one user tell me he was using it as an alternative to the amazing GLM. He just found some issues on calculations and I reviewed the library to align it in usage and results with GLM. Just wanted to share it in case someone could find it useful. 
msmshazan
Shazan Shums
169 posts
Some day I will make quality software. 
#12590
raymath  a simple 3d math library 1 year, 7 months ago
Thanks raysan5 was really looking forward to this.
And thanks for making this great game framework (raylib). Just being curious on programming.... 
ratchetfreak
429 posts

#12591
raymath  a simple 3d math library 1 year, 7 months ago
in QuatSlerp you don't need to get the sinHalfTheta testing if cosHalfTheta>0.95 is enough to fallback to nlerp. Also you may want to add nlerp as an explicit option.
in QuaternionToMatrix you should divide xx, xy, xz, ... with the length squared. Or replace the 1.0f with the length squared so the calculation works with nonnormalized quaternions. I'm also not a fan of only having axis angle as a way to create quaternions. A way to create a quaternion based on the rotation from one vector to another will allow the user to avoid the acos > cos roundtrip:

raysan5
Ray
47 posts
/ 1 project
I love videogames development. 
#12596
raymath  a simple 3d math library 1 year, 7 months ago
Thank you very much for your feedback!
ratchetfreak, thanks for the proposed improvements, the Quaternions functionality of the library hasn't been the most used one at this point so probably some functions are missing or buggy. I'll work on that. Any proposed improvement is very welcomed! Please, just let me know! 
mrmixer
Simon Anciaux
535 posts

#12601
raymath  a simple 3d math library 1 year, 7 months ago Edited by Simon Anciaux on July 22, 2017, 5:58 p.m. Reason: Typo
I'm just thinking out loud but wouldn't it be useful to have a second set of functions that works with arrays of floats instead of your VectorX types for people that already have their own vector types ? If so how would you handle the return value ? (output parameter ?)

raysan5
Ray
47 posts
/ 1 project
I love videogames development. 
#12603
raymath  a simple 3d math library 1 year, 6 months ago
ratchetfreak, just implemented proposed reviews and additional functions. Thanks!
mrmixer, it will require a big rewrite/addition of functions, it's simpler to just use proposed structs. In any case, if user has its own data structs for vector3/matrix/quaternion, they can easily be redefined as raymath Vector3/Matrix/Quaternion structs. 