negativzero
New Member
I've got array of coordinates in following schema (x,y):\[code\]array = [[1,2],[1,5],[1,1],[2,2],[2,5],[2,1]]\[/code\]I would like to do some process to achieve effect:\[code\]array1 = [[[1,2],[1,5],[1,1]],[[2,2],[2,5],[2,1]]]; array2 = [[[2,2],[2,5],[2,1]]]\[/code\]and\[code\]array1a = [[[1,2],[2,2]]]; array2a = [[[1,5],[2,5]]]; array3a=[[[1,1],[2,1]]]\[/code\]in other words I would like to get coordinates of all parallel and perpendicular lines.I've came up with two double loops (one by x, and another by y) but maybe there is another faster(better) way--pseudo code:\[quote\]\[code\] for (var i = 0; i < length; i++) { for (var j = 0; j < length2; j++) { var x = points[j][0]; var y = points[j][1]; }; }; for (var i = 0; i < length2; i++) { for (var j = 0; j < length; j++) { var x = points[j][0] ; var y = points[j][1] ; }; };\[/code\]\[/quote\]