I have an array of point objects with x and y parameters such as :
this.points = [p1, p2, p3,..];
Which I flatten as a 1D array like so :
this.coords = [];
for(let p of this.points){
this.coords.push(p.x);
this.coords.push(p.y);
}
The coords array is now :
this.coords = [p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, ...]
My question is the following, I would like the modifications of either one of the arrays affect the other. Because right now when I make a modification to either this.coords or this.points, the other one isn't updated.
Is there a way of doing this, or am I thinking about this wrong and there is a general guideline to coding coordinates that I do not know of yes ?
Thanks