Revision 19555 trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/layers/functions/ExponentialLine.java
ExponentialLine.java | ||
---|---|---|
47 | 47 |
* @see org.gvsig.gui.beans.canvas.DrawableElement#firstDraw() |
48 | 48 |
*/ |
49 | 49 |
public void firstDrawActions() { |
50 |
int value = Math.min(canvas.getCanvasWidth(), canvas.getCanvasHeight()); |
|
51 |
xPoints = new int[value]; |
|
52 |
yPoints = new int[value]; |
|
53 |
for (int i = canvas.getCanvasMinY(); i < canvas.getCanvasMaxY(); i++) { |
|
54 |
yPoints[i] = value - (int)(value * Math.exp((double)i / 64) / Math.exp(3)); |
|
55 |
xPoints[i] = i; |
|
50 |
xPoints = new int[canvas.getCanvasWidth()]; |
|
51 |
yPoints = new int[canvas.getCanvasHeight()]; |
|
52 |
double pos = Math.log(canvas.getCanvasMinY()); |
|
53 |
double max = Math.log(canvas.getCanvasMaxY()); |
|
54 |
double increase = (max - pos) / canvas.getCanvasHeight(); |
|
55 |
for (int i = canvas.getCanvasMinY(); i < canvas.getCanvasMaxY(); i++) { |
|
56 |
try { |
|
57 |
//yPoints[i] = value - (int)(value * Math.exp((double)i / 64) / Math.exp(3)); |
|
58 |
yPoints[i - canvas.getCanvasMinY()] = canvas.getCanvasHeight() - (int)Math.round(Math.exp(pos)); |
|
59 |
xPoints[i - canvas.getCanvasMinX()] = i; |
|
56 | 60 |
//System.out.println(xPoints[i] + " " + yPoints[i]); |
57 | 61 |
//System.out.println(Math.exp((double)i/85)); |
62 |
System.out.println(xPoints[i - canvas.getCanvasMinX()] + " : " + pos + " : " + yPoints[i - canvas.getCanvasMinY()]); |
|
63 |
pos += increase; |
|
64 |
} catch(ArrayIndexOutOfBoundsException e) {} |
|
58 | 65 |
} |
59 | 66 |
} |
60 | 67 |
|
Also available in: Unified diff