This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Note that those constants have far more precision in them than a float can represent. You only get about 7 decimal digits in a float.
If you really need all that precision (unlikely?), then use double.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: Apr 11, 2005
Here is an output of the exception. That is when I used this line... return new AffineTransform(0.0f,-0.02999f,0.0f,0.99955f,130.0f,288.78218f); I could obviously catch it, but thats like sweeping up rubbish under the carpet, and pretending its not there, I would rather know why I get an exception. Any help is much appreciated. Thanks
java.awt.image.ImagingOpException: Unable to invert transform AffineTransform[[0.0, 0.0, 130.0], [-0.029990000650287, 0.999549984931946, 288.78216552734375]] at java.awt.image.AffineTransformOp.validateTransform(Unknown Source) at java.awt.image.AffineTransformOp.<init>(Unknown Source) at sun.java2d.pipe.DrawImage.transformImage(Unknown Source) at sun.java2d.pipe.DrawImage.copyImage(Unknown Source) at sun.java2d.pipe.DrawImage.copyImage(Unknown Source) at sun.java2d.SunGraphics2D.drawImage(Unknown Source) at sun.awt.image.ImageRepresentation.drawToBufImage(Unknown Source) at sun.java2d.pipe.DrawImage.copyImage(Unknown Source) at sun.java2d.pipe.ValidatePipe.copyImage(Unknown Source) at sun.java2d.SunGraphics2D.drawImage(Unknown Source) at sun.java2d.SunGraphics2D.drawImage(Unknown Source) at rubik.Drawer.drawImage(Drawer.java:275)
Well, the numbers you put into your AffineTransform result in a transformation that maps the entire plane into a single line. You can see this because its determinant is zero. This can't be inverted as it isn't a one-to-one mapping. Evidently whatever you were trying to do has a problem with degenerate transformations.
Read the documentation for AffineTransform, especially the getDeterminant() method, for more information.
Joined: Apr 11, 2005
Excellent, I was thinking it was something like that. Didn't really consider the determinant, but that explains why it says "Unable to invert transform..." Because you can't invert a matrix that has a zero determinant.
I'm basically building a rubiks cube, and it when it loads up, it shows the cube from the front, but also tries to draw 2 of the side faces, which are really just lines, hence the zero determinant,