Transform { public DblPoint inverse(final Point point) { final double scale = this.ctx.scale(); final DblPoint center = this.ctx.center(); return new DblPoint( (point.x - this.ctx.width() / 2d) / scale + center.dblx(), (this.ctx.height() / 2d - point.y) / scale + center.dbly() ); } Transform(final Surface ctx);  Transform(final Surface ctx, final Field<Double> field); Point transform(final DblPoint point); Point transform(final XyPoint<Double> point); Point transform(final Vect<Double> point); DblPoint inverse(final Point point);  }
@Test public void transformsAwtPoint() { final int xcoor = 2003; final int ycoor = 1956; final Surface ctx = TransformTest.context(); MatcherAssert.assertThat( new Transform(ctx).inverse(new Point(xcoor, ycoor)), Matchers.equalTo( new DblPoint( (xcoor - ctx.width() / 2d) / ctx.scale() + ctx.center().dblx(), (ctx.height() / 2d - ycoor) / ctx.scale() + ctx.center().dbly() ) ) ); }