Working on the tiramisu game framwork I miss a function for lerping a vector like this:
pubfnlerp(a:Vec3,b:Vec3,t:Float)->Vec3{Vec3(a.x+.{b.x-.a.x}*.t,a.y+.{b.y-.a.y}*.t,a.z+.{b.z-.a.z}*.t,)}Do you think it's sensible to add it to the library?
linear_interpolation and other math functions #1
Working on the tiramisu game framwork I miss a function for lerping a vector like this:
pubfnlerp(a:Vec3,b:Vec3,t:Float)->Vec3{Vec3(a.x+.{b.x-.a.x}*.t,a.y+.{b.y-.a.y}*.t,a.z+.{b.z-.a.z}*.t,)}Do you think it's sensible to add it to the library?
Ah yes, I was considered adding this function along with move_toward and sign but I'm not sure how...
Because all of these functions are all also useful to standard Float and Int type but none of them are in the stdlib (yet, maybe...).
If they are in the stdlib, it would be easy. We just need to add them like other functions in gleam/float and gleam/int to vec.
The sign function is in the gleam_comunity/maths lib, perhap we could make a PR to add lerp and move_toward to it, then make a subfoder vec/maths or a new lib vec_maths to house those functions and more.
https://github.com/gleam-community/maths/issues/48
This will be added in the (削除) very near (削除ここまで) future.
gleam_comunity/maths related functions gleam_comunity/maths related functions (削除ここまで)I take it back, the gleam_comunity/maths is way too much T_T.
I'm thinking about adding map3 instead:
pubfnmap3(a:Vec3(a),b:Vec3(b),c:Vec3(c),withfun:fn(a,b,c)->d,)->Vec3(d){Vec3(fun(a.x,b.x,c.x),fun(a.y,b.y,c.y),fun(a.z,b.z,c.z))}This will not only make using linear_interpolation easier but also other function that take 2 vectors and a weight/delta (with splash to turn a Float into a Vec(Float)). Like clamp, move_toward, inverse_linear_interpolation, ...
linear_interpolation functions Year I'm in favor of map3 over making functions from or could be from maths lib to Vec. Since I find linear_interpolation is quite rare to use, not "never", just rare. So if someone want to use it 1 or 2 time in a project, using map3 is fine.
If anyone feel different, please reopen this issue, and add the reason.
This is back on the table now!
linear_interpolation functions (削除ここまで)linear_interpolation and other math functions No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?