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]); } }
/** * 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]); } }
Projector vp = getVerticalProjector(); Transcaler ts = getTranscaler(); ts = ts.combineWith(hp,vp);
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 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); }
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 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))); }