Pseudocode example for updating x y z coordinates
@Jack I'm assuming you're starting with coordinates in camera space.Multiplying by 1000 (or whatever number) and dividing by Z gets you to screen space.I mean, they translate as objects move, but they do not undergo coordinate space transformations. Then you scale the resulting values to get the desired field of view.This is assuming the camera is located at the origin and the Z axis points into the screen, so do this after any camera rotation/translation has been applied.It's open source if you're curious for details.:) The X, Y, Z and scale properties are separate from Starling's display objects, I only set the real x/y/scale once all the transformations are done, and the untransformed X/Y/Z/Scale are also kept intact. Perspective projection just means dividing each object's XY position and size by its Z distance from the camera.As with the article on linear interpolation, this article is in preparation for the upcoming discussion on image rotation. I did some research, and to my surprise, there’s no such thing as a raster coordinate system! For illustration, suppose w is the width of the image and h is the height of the image (in pixels). To determine the formula for raster-Cartesian conversion, let’s look at the four corners of the image. The sine and cosine functions take in any real values. UPDATE: “I’m dying to look at the code for rotating images with bilinear interpolation! ” Spreadsheet software library Do you find existing libraries hard to use?
I don't think angle would have the same treatment, but "rotation since last frame" would, no ?
I think I updated the fiddle instead of forking it :( I apologize for that!
I left several comments which hopefully clearly outline what I did and why.
I'm not sure how helpful this will be to you, but you might want to look at the projection matrix formula shown on this page from the Direct3D API documentation.
In D3D and similar APIs, perspective projection is done by multiplying a point like [x, y, z, 1] by this matrix, then dividing the result by its fourth component (see What does the graphics card do with the fourth element of a vector? Again, this is done after any camera rotation/translation are applied.