/* Usage of this class - PlotRoller PlotPt = new PlotRoller(int fx, int fy); g.fillOval(PlotPt.xpoint(), PlotPt.ypoint(), 4,4); */ class PlotRoller { private double mfx = 0.0, mfy = 0.0; private boolean inside=false; //default constructor public PlotRoller() { this.mfx=0.0; this.mfy=0.0; } //constructor public PlotRoller(int fx, int fy) { this.mfx = (double)fx; this.mfy = -(double)fy; } //method to return x plot value public int xpoint() { double fx = (150-(-mfy))/50; fx = 200*fx + 100; return (int)fx; } //method to return y plot value public int ypoint() { double fy = Math.tan(Math.acos(1- ((150-(-mfy))/50) )); fy = 430-(fy*20); return (int)fy; } //method to return x value public double xval() { double fx = (150-(-mfy))/50; return fx; } //method to return y value public double yval() { double fy = Math.tan(Math.acos(1- ((150-(-mfy))/50) )); return fy; } //method to return x plot value from circles edge public int xcircle() { double fx = Math.sqrt(50*50 - (100-(-mfy))*(100-(-mfy))); fx = fx+100; return (int)fx; } //method to return x plot value for "N" public int NXVal() { double nfx; double fx = Math.sqrt(50*50 - (100-(-mfy))*(100-(-mfy))); fx = fx+100; nfx = Math.abs((200-100)/(-mfy-100)*(fx-100)) + 100; return (int) nfx; } //method to see if "inside" valid region public boolean isInside() { if ( (mfx>100) & (-mfy>100) & (-mfy<150) ) inside=true; else inside=false; return inside; } }