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.