Creates a Vec2; may be called with x, y, z to set initial values.
Note: Since passing in a raw JavaScript array
is valid in all circumstances, if you want to
force a JavaScript array into a Vec2's specified type
it would be faster to use
constv = vec2.clone(someJSArray);
Note: a consequence of the implementation is if your Vec2Type = Array
instead of Float32Array or Float64Array then any values you
don't pass in will be undefined. Usually this is not an issue since
(a) using Array is rare and (b) using vec2.create is usually used
to create a Vec2 to be filled out as in
Creates a Vec2; may be called with x, y, z to set initial values.
Note: Since passing in a raw JavaScript array is valid in all circumstances, if you want to force a JavaScript array into a Vec2's specified type it would be faster to use
Note: a consequence of the implementation is if your Vec2Type =
Array
instead ofFloat32Array
orFloat64Array
then any values you don't pass in will be undefined. Usually this is not an issue since (a) usingArray
is rare and (b) usingvec2.create
is usually used to create a Vec2 to be filled out as in