[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fix for inverseTransform()
From: |
Eric Blake |
Subject: |
Re: fix for inverseTransform() |
Date: |
Thu, 17 Feb 2005 06:40:17 -0700 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
Please send bug reports to the project mailing list, not to individual
developers. Lately I have not had any time to actively work on classpath
fixes.
According to Tim Janik on 2/14/2005 7:29 PM:
> hi tom, eric.
>
> during code review of AffineTransform.java (for a C++ project actually),
> i came across a bug in inverseTransform().
> in order for inverseTransform() to match createInverse().transform(),
> nx and ny in:
>
> public Point2D inverseTransform(Point2D src, Point2D dst)
> throws NoninvertibleTransformException
> {
> double det = getDeterminant();
> if (det == 0)
> throw new NoninvertibleTransformException("couldn't invert
> transform");
> if (dst == null)
> dst = new Point2D.Double();
> double x = src.getX();
> double y = src.getY();
> double nx = (m11 * x + -m10 * y) / det - m02;
> double ny = (m01 * x + -m00 * y) / det - m12;
> dst.setLocation(nx, ny);
> return dst;
> }
>
> need to be calculated as:
>
> double nx = (m11 * x + -m01 * y) / det - m02;
> double ny = (-m10 * x + m00 * y) / det - m12;
>
>
> ---
> ciaoTJ
>
- Re: fix for inverseTransform(),
Eric Blake <=