Java 仿射变换和翻转y轴

Java 仿射变换和翻转y轴,java,math,graphic,Java,Math,Graphic,我在尝试翻转我创建的坐标系的y轴时遇到了一个奇怪的问题: private AffineTransform getTransform() { if (transform == null) { transform = new AffineTransform(); double scaleX = (double) this.getWidth() / (coordinateSystem.getMaxX() - coordinateSy

我在尝试翻转我创建的坐标系的y轴时遇到了一个奇怪的问题:

   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;
    }
仿射变换设置为缩放和平移。除了y值被反转(最大值在坐标系的底部,最小值在顶部)之外,一切都正常。我尝试通过反转y轴的比例因子来切换。但这不起作用

我是否必须让变换旋转PI,以实现翻转的y轴? y轴的比例因子乘以-1不应该是一样的吗?

你有一个打字错误

double scaleX = (double) this.getWidth() / (coordinateSystem.getMaxX() - coordinateSystem.getMinY());

(最后一个
Y
应该是
X
)也许就是这样。

通过PI旋转实际上根本不是一个正确的解决方案,因为它将翻转X轴和Y轴