public class convertxy
{
public static double[] convert(double[] xy) // Converts cartisian points to pixel points
{
double b1,b2,x1,y1,newx1,newy1,newx2,newy2,m1,m2,x,y,y11,x11;
int x2,x3,x4,y2,y3,y4;
x11=-16; //Upper left hand x
y11=14; //Upper left hand y
x2=16; //Lower right hand x
y2=-14; //Lower right hand y
x3=0; //Upper left pixel1
y3=0; //Upper left pixel2
x4=639; //Lower left pixel1
y4=559; //Lower left pixel2
newx1=x3+x11;
newy1=y3+y11;
newx2=x4+x2;
newy2=y4+y2;
m1=(newx1/newy1);
m2=(newx2/newy2);
x=xy[0];
y=xy[1];
b1=(m1*(-14));
b2=(m2*(-16));
x1=(m1*x)+b1;
y1=(m2*y)+b2;
y1*=-1;
xy[0]=x1;
xy[1]=y1;
System.out.println(xy[0]+" "+xy[1]);
return xy;
}
}