This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi there, I've built a rubiks cube using images. I use AffineTransforms generated from a matrix M that I've specially built.
This works fine, and the effect is great. However there is no perspective on this cube.
I understand how to do perspective in general(1 point), Using a coordinate system, with: x axis being horizontal, y axis going into/out of screen(+ve y axis pointing out of screen) z axis being vertical,
I simply transform any point (x,y,z) to (F'x,y,F'z) where F'=F/(F-y), and F is focal point out of screen (0,F,0). When the point is plotted, you ignore the y component.
I've seen an applet with a cube with an image that has perspective, so I was wondering how I can do this.
I know AffineTransforms can only turn squares into paralellograms, so I guess an AffineTransform is out of the question. Many images could be pre-stored at different angles, but this is not a great way of doing it generally. The image could be rebuilt using pixel data, and the animation techinque with MemoryImageSource, but this could be costly on the cpu when doing so many repaints in a short time.