14 lines
281 B
JavaScript
14 lines
281 B
JavaScript
module.exports = clone
|
|
|
|
/**
|
|
* Creates a new vec2 initialized with values from an existing vector
|
|
*
|
|
* @param {vec2} a vector to clone
|
|
* @returns {vec2} a new 2D vector
|
|
*/
|
|
function clone(a) {
|
|
var out = new Float32Array(2)
|
|
out[0] = a[0]
|
|
out[1] = a[1]
|
|
return out
|
|
} |