Skip to main content

[JAVA2D] NoninvertibleTransformException

3 replies [Last post]
Anonymous

Hello,

I posted this earlier on the 2D forum but got no response, so I thought
I'd try here:

Does anyone know under what circumstances
AffineTransform.inverseTransform() is

A. likely to throw a NoninvertibleTransformException ?

B. unlikely to throw a NoninvertibleTransformException ?

In my application I use Scale and Translate and Rotate, I do not use
Shear.

Any help understanding what circumstances would cause the exception and
possible strategies for how to deal with it would be appreciated.

Thanks,

Ted Hill

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jim Graham

> Does anyone know under what circumstances
> AffineTransform.inverseTransform() is

Mathematically, this occurs when the matrix has a zero determinant.

Visually this happens when the transform specifies a transform that
maps all coordinates in user space to a line or a point in device
space.

(To understand how the two relate, when you invert the transform
you are asking "If this transform takes points in the original
coordinate space and maps them on to points in a destination
coordinate space, what is the transform that reverses that
transformation?" If the mapping in one direction is from a
plane to a point, then how can a reverse mapping be created to
specify how to map that point onto all of the coordinates of
the original plane? It can't - thus the transform is not
invertible...)

> In my application I use Scale and Translate and Rotate, I do not use
> Shear.

Of the 3 - Scale, Translate, and Rotate, the only one of the 3 that
has a chance to map all user space coordinates to a line or a point
in device space would be the Scale type. As long as you never
scale to a size of 0 in either or both of the X or Y direction then
you should be OK.

An example of where something like this is likely to occur in
practice is if you animate a figure to flip over by scaling it
with values that vary from 1.0 (normal rendering) down to
-1.0 (flipped rendering). As you iterate through the scale
values from 1.0 to -1.0 you can at some point in the middle
have a scale of 0.0 along the axis you are flipping it over.
That is the point at which, visually, the figure looks like
it is temporarily "side on" to your point of view and hard to
see because it is so thin. And at this point in time you will
have a transform that is mapping all coordinates in the figure
to that thin vertical or horizontal line. At that point, the
transform also happens to be invertible...

...jim

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Jim Graham

> An example of where something like this is likely to occur in
> practice is if you animate a figure to flip over by scaling it
> with values that vary from 1.0 (normal rendering) down to
> -1.0 (flipped rendering). As you iterate through the scale
> values from 1.0 to -1.0 you can at some point in the middle
> have a scale of 0.0 along the axis you are flipping it over.
> That is the point at which, visually, the figure looks like
> it is temporarily "side on" to your point of view and hard to
> see because it is so thin. And at this point in time you will
> have a transform that is mapping all coordinates in the figure
> to that thin vertical or horizontal line. At that point, the
> transform also happens to be invertible...

As someone pointed out to me - that last word is wrong, the
last line should read:

transform also happens to be *non*invertible...

...jim

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Jim

Scaling, translation and rotation are all invertable. If I remember
right, the only time the matrix will be noninvertable is when the
diagonal of the matrix does not contain 1's.

Ted Hill wrote:

> Hello,
>
> I posted this earlier on the 2D forum but got no response, so I
> thought I?d try here:
>
> Does anyone know under what circumstances
> AffineTransform.inverseTransform() is
>
> A. likely to throw a NoninvertibleTransformException ?
>
> B. unlikely to throw a NoninvertibleTransformException ?
>
> In my application I use Scale and Translate and Rotate, I do not use
> Shear.
>
> Any help understanding what circumstances would cause the exception
> and possible strategies for how to deal with it would be appreciated.
>
> Thanks,
>
> Ted Hill
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body of the message "signoff JAVA2D-INTEREST". For general help, send
> email to listserv@java.sun.com and include in the body of the message
> "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".