Here is my code for look up table - where i am planning to built 10 colums and 8 rows and put [x,y] array values in the table boxes. Problem is - it is only printing the last array valules instead of all
[CODE=javascript] var maxRow = 10;
var maxCol = 8;
var height1 = 480;
var width1 = 640;
function CenteringError( Xe, Ye){
var table = new Array ( ([5,0], [2,-3], [2,-3], [1,-2], [0,-2], [0,-1], [1,-1], [1,-1], [0,-1], [-5,2]),
([3,-2], [-1,-3], [-1,-3], [1,-2], [-1,-2], [1,-1], [1,-1], [2,-2], [2,-2], [-3,-1]),
([1,-3], [-2,-3], [-2,-3], [-2,-2], [-1,-2], [0,0], [1,-1], [2,-1], [2,-1], [1,-2]),
([-2,0], [-2,-1], [-2,-1], [-2,0], [-1,0], [1,0], [2,0], [2,0], [2,0], [2,0]),
([-2,-1], [-2,-1], [-2,-1], [-2,0], [-1,0], [1,0], [3,0], [2,1], [2,1], [2,0]),
([-1,1], [-2,0], [-2,0], [-2,1], [-1,1], [1,1], [2,1], [2,1], [2,2], [1,2]),
([-1,2], [-2,1], [-2,1], [-2,1], [-1,2], [-1,1], [1,1], [1,3], [1,2], [-2,3]),
([4,1], [0,0], [-1,0], [-1,0], [-1,0], [0,2], [0,1], [-1,2], [-1,3], [-4,2])
);
var correct = [0,0];
//this math function gets mouse pos and builts Rows and Colums in Viewer
correct[0] = table[Math.round((max Row* Ye)/height1)];
correct[1] = table[Math.round((max Col* Xe)/width1)];
var x = correct[0];
var y = correct[1];
alert(x + " " + y);
}
[/CODE]
I am alerting x and y values but it only prints certain numbers and repeats it. This program is not working properly. I dont know why.
Help would be appreciated...
Thanks
[CODE=javascript] var maxRow = 10;
var maxCol = 8;
var height1 = 480;
var width1 = 640;
function CenteringError( Xe, Ye){
var table = new Array ( ([5,0], [2,-3], [2,-3], [1,-2], [0,-2], [0,-1], [1,-1], [1,-1], [0,-1], [-5,2]),
([3,-2], [-1,-3], [-1,-3], [1,-2], [-1,-2], [1,-1], [1,-1], [2,-2], [2,-2], [-3,-1]),
([1,-3], [-2,-3], [-2,-3], [-2,-2], [-1,-2], [0,0], [1,-1], [2,-1], [2,-1], [1,-2]),
([-2,0], [-2,-1], [-2,-1], [-2,0], [-1,0], [1,0], [2,0], [2,0], [2,0], [2,0]),
([-2,-1], [-2,-1], [-2,-1], [-2,0], [-1,0], [1,0], [3,0], [2,1], [2,1], [2,0]),
([-1,1], [-2,0], [-2,0], [-2,1], [-1,1], [1,1], [2,1], [2,1], [2,2], [1,2]),
([-1,2], [-2,1], [-2,1], [-2,1], [-1,2], [-1,1], [1,1], [1,3], [1,2], [-2,3]),
([4,1], [0,0], [-1,0], [-1,0], [-1,0], [0,2], [0,1], [-1,2], [-1,3], [-4,2])
);
var correct = [0,0];
//this math function gets mouse pos and builts Rows and Colums in Viewer
correct[0] = table[Math.round((max Row* Ye)/height1)];
correct[1] = table[Math.round((max Col* Xe)/width1)];
var x = correct[0];
var y = correct[1];
alert(x + " " + y);
}
[/CODE]
I am alerting x and y values but it only prints certain numbers and repeats it. This program is not working properly. I dont know why.
Help would be appreciated...
Thanks
Comment