Via XMLHttpRequest I have received arraybuffer of Uint32 values
oReq.onload = function (oEvent) {
var arrayBuffer = oReq.response;
if (arrayBuffer) {
pointsArray = new Uint32Array(arrayBuffer);
However, I know that this array has an internal structure. Say, pointsArray length is 10 but I know it contains 5 points X,Y coordinates.
How can I create( hopefully without copy ) two new 'views' at this pointsArray so that I can index X and Y points separately?
Something like:
var xArray = something (pointsArray)
var yArray = something else (pointsArray)
Then, even if pointsArray length is 10, my new two arrays will have a length of 5 so I can index them from 0 to 4.
EDIT: The question is imprecise. It implies that original input array can't be modified so the answer by David Alvarez is correct, despite the stated preference for avoiding any copies, which, in turn, for the best performance may require the format of the input array to be modified.