I ran into some strange problem while trying to flip the y axis of the coordinate system that im creates:
private AffineTransform getTransform() { if (transform == null) { transform = new AffineTransform(); double scaleX = (double) this.getWidth() / (coordinateSystem.getMaxX() - coordinateSystem.getMinY()); double scaleY = (double) this.getHeight() / (coordinateSystem.getMaxY() - coordinateSystem.getMinY()); transform.setToScale(scaleX, scaleY); double deltaX = (coordinateSystem.getMaxX() - coordinateSystem.getMinX()) / 2; double deltaY = (coordinateSystem.getMaxY() - coordinateSystem.getMinY()) / 2; transform.translate(deltaX, deltaY); } return transform; }
AffineTransform is configured to scale and translate. and everything works fine, except that my y values ββare inverted (the maximum value is the bottom of the coordinate system, the minimum value is at the top). I tried to switch this by inverting the scale factor for the y axis. but it didnβt work.
Should I let Transform rotate with PI to achieve the inverted y axis? Shouldn't the scaling factor for the y axis be multiplied by minus 1?
source share