View Full Version : Rotating a Bitmap in 3D - Code example?

 DePaint10-02-2012, 12:17 PMI'm trying to write a function that rotates a Bitmap around the Y-axis in 3D: http://imageshack.us/a/img94/5608/26023832.png Anyone know of a code example in c#, c++, Java et cetera that performs a 3D rotation of a bitmap? I'm not looking for a built-in "bitmap.rotate" function. I'm looking for the low-level method for writing my own bitmap 3D rotation function. Thanks for any help!
ndeboar
10-03-2012, 07:12 AM
Check out rotation matricies:

http://en.wikipedia.org/wiki/Rotation_matrix

If i can find some source code, ill post it, but transformation matricies are the basis of most moving/scaling/rotations functions

DePaint
10-03-2012, 08:26 AM
Thank you, Nick. I'll check it out.

ThE_JacO
10-05-2012, 12:34 AM
For the record, you're not as much after rotating something in 3D, which in the case you point out could be done with some extremely simple geometric work, as much as you are about dealing with perspective.

What you show there isn't rotating di per se', as much as it's finding the screen space through a perspective camera of that object.

Without a camera implementation of some sorts you might as well fake the transform in 2D and eyeball it (by moving the points in X by an inversely proportional amount of their Y offset, and redistributing the "depth" pixels somewhat arbitrarily within that transform).

DePaint
10-05-2012, 11:21 AM
Thanks Jaco. I'll try that out.

CGTalk Moderation
10-05-2012, 11:21 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.

1