UNPKG

@jscad/modeling

Version:

Constructive Solid Geometry (CSG) Library for JSCAD

19 lines (17 loc) 501 B
/** * Performs a linear interpolation between two vectors. * * @param {vec3} out - receiving vector * @param {vec3} a - first operand * @param {vec3} b - second operand * @param {Number} t - interpolant (0.0 to 1.0) applied between the two inputs * @returns {vec3} out * @alias module:modeling/maths/vec3.lerp */ const lerp = (out, a, b, t) => { out[0] = a[0] + t * (b[0] - a[0]) out[1] = a[1] + t * (b[1] - a[1]) out[2] = a[2] + t * (b[2] - a[2]) return out } module.exports = lerp