protected int el_y(int idx)
{
// Undistorted Y
- double undy = (double)idx * allocation.height / list.length;
+ int undy = idx * allocation.height / list.length;
// Distorted position
- double pos = fisheye(undy, focus_centre, distortion_factor, 0, allocation.height);
+ int pos = fisheye(undy, focus_centre, distortion_factor, 0, allocation.height);
//stderr.printf("%d %f %f\n", idx, undy, pos);
- return (int)Math.round(pos);
+ return pos;
}
protected void focus_layout()
* @param max the end of the display
* @return the distorted coordinate
*/
- private double fisheye(double x, int a, double d, int min, int max)
+ private int fisheye(int x, int a, double d, int min, int max)
{
if ( d != 0 ) {
bool left = x<a;
if ( m == 0 ) m = max-min;
v = Math.fabs(x - a) / m;
v = (d+1)/(d+(1/v));
- return (left?-1:1)*m*v + a;
+ return (int)Math.round((left?-1:1)*m*v + a);
} else {
return x;
}