/** * Transforms a pixel x coordinate to a horizontal world coordinate. * @param x the pixel x coordinate. * @return the horizontal world coordinate. */ public double pixelToWorldHorizontal(int x) { return _hp.v(_ts.x(x)); }
private void computeXY( Projector hp, Projector vp, Transcaler ts, int n, float[] x1, float[] x2, int[] x, int[] y) { ts = ts.combineWith(hp,vp); float[] xv = null; float[] yv = null; if (_orientation==Orientation.X1RIGHT_X2UP) { xv = x1; yv = x2; } else if (_orientation==Orientation.X1DOWN_X2RIGHT) { xv = x2; yv = x1; } for (int i=0; i<n; ++i) { x[i] = ts.x(xv[i]); y[i] = ts.y(yv[i]); } }
public void paintToRect(Graphics2D g2d, int x, int y, int w, int h) { g2d = createGraphics(g2d,x,y,w,h); //g2d.setRenderingHint( // RenderingHints.KEY_ANTIALIASING, // RenderingHints.VALUE_ANTIALIAS_ON); double x1u = 0.0; double y1u = 1.0; double x2u = 2.0*PI*_cycles; double y2u = -1.0; int x1d = 0; int y1d = 0; int x2d = w-1; int y2d = h-1; Transcaler ts = new Transcaler(x1u,y1u,x2u,y2u,x1d,y1d,x2d,y2d); int nx = 10000; double dx = (x2u-x1u)/(nx-1); double fx = 0.0; int x1 = ts.x(fx); int y1 = ts.y(sin(fx)); for (int ix=1; ix<nx; ++ix) { double xi = fx+ix*dx; int x2 = ts.x(xi); int y2 = ts.y(sin(xi)); g2d.drawLine(x1,y1,x2,y2); x1 = x2; y1 = y2; } g2d.dispose(); } protected void paintComponent(Graphics g) {
/** * Computes coordinates for a contour segment. */ private void computeXY( Projector hp, Projector vp, Transcaler ts, int n, float[] x1, float[] x2, int[] x, int[] y) { ts = ts.combineWith(hp,vp); float[] xv,yv; if (_transposed) { xv = x2; yv = x1; } else { xv = x1; yv = x2; } for (int i=0; i<n; ++i) { x[i] = ts.x(xv[i]); y[i] = ts.y(yv[i]); } }
private Point complexToPoint(Cdouble z) { Transcaler ts = _tile.getTranscaler(); Projector hp = _tile.getHorizontalProjector(); Projector vp = _tile.getVerticalProjector(); double xu = hp.u(z.r); double yu = vp.u(z.i); int xp = ts.x(xu); int yp = ts.y(yu); return new Point(xp,yp); }
float[] ye = yv[ie]; for (int ip=0; ip<np; ++ip) { xp[ip] = ts.x(xe[ip]); yp[ip] = ts.y(ye[ip]);
public void testCombineWithLogB () { Transcaler tr = new Transcaler(0.0, 0.0, 1.0, 1.0, 0, 0, 100, 100); Projector xp = new Projector(1.0, 10.0, AxisScale.LOG10); Projector yp = new Projector(50.0, 1.0, AxisScale.LOG10); Transcaler tr_c = tr.combineWith(xp, yp); assertToleranceClose(Math.log10(5.0), tr_c.x(tr_c.x(5.0)), 0.02); assertToleranceClose(Math.log10(26.0), tr_c.y(tr_c.y(26.0)), 0.02); assertToleranceClose(75, tr_c.x(Math.pow(10,tr_c.x(75))), 0.02); assertToleranceClose(13, tr_c.y(Math.pow(10,tr_c.y(13))), 0.02); }
public void testBasicTranscale () { Transcaler tr = new Transcaler(0.0, 0.0, 1.0, 1.0, 0, 0, 100, 100); assertVeryClose(0.0, tr.x(0)); assertVeryClose(0.5, tr.y(50)); assertVeryClose(0.77, tr.x(77)); assertVeryClose(10, tr.y(0.1)); assertVeryClose(83, tr.x(0.83)); assertVeryClose(0.36, tr.x(tr.x(0.36))); assertVeryClose(0.74, tr.y(tr.y(0.74))); assertVeryClose(12, tr.x(tr.x(12))); assertVeryClose(63, tr.y(tr.y(63))); }
public void testCombineWithLogA () { Transcaler tr = new Transcaler(0.0, 0.0, 1.0, 1.0, 0, 0, 100, 100); Projector xp = new Projector(10.0, 1000.0, AxisScale.LOG10); Projector yp = new Projector(1.0, 1000.0, AxisScale.LOG10); Transcaler tr_c = tr.combineWith(xp, yp); assertToleranceClose(Math.log10(15.0), tr_c.x(tr_c.x(15.0)), 0.02); assertToleranceClose(Math.log10(5.0), tr_c.y(tr_c.y(5.0)), 0.02); assertToleranceClose(75, tr_c.x(Math.pow(10,tr_c.x(75))), 0.02); assertToleranceClose(75, tr_c.y(Math.pow(10,tr_c.y(75))), 0.02); }
private void computeXY( Projector hp, Projector vp, Transcaler ts, int n, float[] x1, float[] x2, int[] x, int[] y) { ts = ts.combineWith(hp,vp); float[] xv = null; float[] yv = null; if (_orientation==Orientation.X1RIGHT_X2UP) { xv = x1; yv = x2; } else if (_orientation==Orientation.X1DOWN_X2RIGHT) { xv = x2; yv = x1; } double hLeft = Math.min(hp.v0(),hp.v1()); double vBot = Math.min(vp.v0(),vp.v1()); for (int i=0; i<n; ++i) { x[i] = ts.x((xv[i]<=0 && hp.getScale()==AxisScale.LOG10)?hLeft:xv[i]); y[i] = ts.y((yv[i]<=0 && vp.getScale()==AxisScale.LOG10)?vBot:yv[i]); } }
public void testCombineWithLinearA () { Transcaler tr = new Transcaler(0.0, 0.0, 1.0, 1.0, 0, 0, 100, 100); Projector xp = new Projector(0.0, 10.0, AxisScale.LINEAR); Projector yp = new Projector(0.0, 50.0, AxisScale.LINEAR); Transcaler tr_c = tr.combineWith(xp, yp); assertVeryClose(5.0, tr_c.x(tr_c.x(5.0))); assertVeryClose(5.0, tr_c.y(tr_c.y(5.0))); assertVeryClose(75, tr_c.x(tr_c.x(75))); assertVeryClose(75, tr_c.y(tr_c.y(75))); }
public void testCombineWithLinearB () { Transcaler tr = new Transcaler(0.0, 0.0, 1.0, 1.0, 0, 0, 100, 100); Projector xp = new Projector(0.0, 10.0, AxisScale.LINEAR); Projector yp = new Projector(50.0, 0.0, AxisScale.LINEAR); Transcaler tr_c = tr.combineWith(xp, yp); assertVeryClose(5.0, tr_c.x(tr_c.x(5.0))); assertVeryClose(5.0, tr_c.y(tr_c.y(5.0))); assertVeryClose(75, tr_c.x(tr_c.x(75))); assertVeryClose(75, tr_c.y(tr_c.y(75))); }
private Cdouble pointToComplex(int x, int y) { Transcaler ts = _tile.getTranscaler(); Projector hp = _tile.getHorizontalProjector(); Projector vp = _tile.getVerticalProjector(); double xu = ts.x(x); double yu = ts.y(y); double xv = hp.v(xu); double yv = vp.v(yu); return roundToReal(new Cdouble(xv,yv)); }
double uymin = min(uy0,uy1); double uymax = max(uy0,uy1); int xd = ts.x(uxmin); int yd = ts.y(uymin); int wd = ts.width(uxmax-uxmin);